mirror of https://github.com/nucypher/nucypher.git
Monkey patch to prevent gas estimates
parent
c0a4f976c6
commit
f58eb7a090
|
@ -20,6 +20,7 @@ import os
|
|||
from typing import List, Tuple
|
||||
|
||||
import maya
|
||||
from eth_tester.exceptions import TransactionFailed
|
||||
from twisted.logger import Logger
|
||||
from web3 import Web3
|
||||
|
||||
|
@ -265,5 +266,7 @@ class TesterBlockchain(BlockchainDeployerInterface):
|
|||
"""Wait for a transaction receipt and return it"""
|
||||
timeout = timeout or self.TIMEOUT
|
||||
result = self.w3.eth.waitForTransactionReceipt(txhash, timeout=timeout)
|
||||
if result.status == 0:
|
||||
raise TransactionFailed()
|
||||
return result
|
||||
|
||||
|
|
|
@ -369,6 +369,14 @@ def _make_testerchain():
|
|||
eth._utils.headers.GAS_LIMIT_MINIMUM = TEST_GAS_LIMIT
|
||||
eth._utils.headers.GENESIS_GAS_LIMIT = TEST_GAS_LIMIT
|
||||
eth.vm.forks.frontier.headers.GENESIS_GAS_LIMIT = TEST_GAS_LIMIT
|
||||
|
||||
# Monkey patch to prevent gas estimates
|
||||
def _get_buffered_gas_estimate(web3, transaction, gas_buffer=100000):
|
||||
return TEST_GAS_LIMIT
|
||||
|
||||
import web3
|
||||
web3.eth.get_buffered_gas_estimate = _get_buffered_gas_estimate
|
||||
|
||||
# Create the blockchain
|
||||
testerchain = TesterBlockchain(eth_airdrop=True, free_transactions=True)
|
||||
BlockchainInterfaceFactory.register_interface(interface=testerchain)
|
||||
|
|
Loading…
Reference in New Issue