From e0985d6bd6897c2be367e314357983b9bc03de2c Mon Sep 17 00:00:00 2001 From: Ben Hauser Date: Wed, 20 May 2020 16:21:27 +0400 Subject: [PATCH] feat: allow use of web3 gas price strategies --- brownie/network/account.py | 2 +- brownie/network/web3.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/brownie/network/account.py b/brownie/network/account.py index 9920eb171..ca229f5e5 100644 --- a/brownie/network/account.py +++ b/brownie/network/account.py @@ -223,7 +223,7 @@ def _gas_limit(self, to: Optional["Accounts"], amount: int, data: Optional[str] def _gas_price(self) -> Wei: gas_price = CONFIG.active_network["settings"]["gas_price"] if isinstance(gas_price, bool) or gas_price in (None, "auto"): - return web3.eth.gasPrice + return web3.eth.generateGasPrice() return Wei(gas_price) def _check_for_revert(self, tx: Dict) -> None: diff --git a/brownie/network/web3.py b/brownie/network/web3.py index fa43af654..02da57321 100644 --- a/brownie/network/web3.py +++ b/brownie/network/web3.py @@ -10,6 +10,7 @@ from web3 import HTTPProvider, IPCProvider from web3 import Web3 as _Web3 from web3 import WebsocketProvider +from web3.gas_strategies.rpc import rpc_gas_price_strategy from brownie._config import CONFIG, _get_data_folder from brownie.convert import to_address @@ -132,6 +133,7 @@ def _resolve_address(domain: str) -> str: web3 = Web3() +web3.eth.setGasPriceStrategy(rpc_gas_price_strategy) try: with _get_path().open() as fp: