Skip to content

Commit

Permalink
Merge pull request #530 from iamdefinitelyahuman/feat-gas-price-strategy
Browse files Browse the repository at this point in the history
Use `web3.eth.generateGasPrice` for gas price
  • Loading branch information
iamdefinitelyahuman committed May 20, 2020
2 parents 6965f47 + e0985d6 commit f99314a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion brownie/network/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions brownie/network/web3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit f99314a

Please sign in to comment.