From b73e74662d5af03361bc7d3526ef80cfdf4bb0f4 Mon Sep 17 00:00:00 2001 From: Yoichi Hirai Date: Mon, 15 Apr 2019 11:25:41 +0200 Subject: [PATCH] Workaround for web3 throwing exception in web3.eth.generateGasPrice() when there are not many transactions in the chain. This fixes https://github.com/raiden-network/raiden/issues/3244 on the procedure documented in https://github.com/raiden-network/raiden/blob/fe45769dd3c3f339b30a214599d028eb8351dc6a/docs/private_net_tutorial.rst --- raiden/network/rpc/client.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/raiden/network/rpc/client.py b/raiden/network/rpc/client.py index 6d7ce40961..6299aaf5b6 100644 --- a/raiden/network/rpc/client.py +++ b/raiden/network/rpc/client.py @@ -611,6 +611,10 @@ def gas_price(self) -> int: # we can sporadically get an AtttributeError here. If that happens # use latest gas price price = int(self.web3.eth.gasPrice) + except IndexError: # work around for a web3.py exception when + # the blockchain is somewhat empty. + # https://github.com/ethereum/web3.py/issues/1149 + price = int(self.web3.eth.gasPrice) return price