Skip to content
Snippets Groups Projects
Commit 6aa05372 authored by Robert Martin-Legene's avatar Robert Martin-Legene
Browse files

parches

parent 615b3d66
No related branches found
No related tags found
No related merge requests found
...@@ -181,20 +181,20 @@ class Account: ...@@ -181,20 +181,20 @@ class Account:
signed = web3.Web3().eth.account.sign_transaction(tx, self.key) signed = web3.Web3().eth.account.sign_transaction(tx, self.key)
return signed return signed
# if kwargs has extragas=50000 then we add that number to the amount
# of gas for the transaction
def calculate_tx_details(self, w3: web3.Web3, *args, **kwargs) -> dict: def calculate_tx_details(self, w3: web3.Web3, *args, **kwargs) -> dict:
# Nonce may have increase on the network without us noticing # if kwargs has extragas=50000 then we add that number to the amount
# of gas for the transaction
afunction = kwargs.get('function')
# Nonce may have increased on the network without us noticing
# or past transactions may not yet have been mined (and a flooded # or past transactions may not yet have been mined (and a flooded
# txpool). # txpool).
# This is a resonable fix (try not to send too many transactions) # This is a resonable fix (try not to send too many transactions)
# If you use waitForTransactionReceipt() between each transaction # If you use waitForTransactionReceipt() between each transaction
# you will not have problems because of this. # you will not have problems because of this.
afunction = kwargs.get('function')
self.nonce = max(self.nonce, w3.eth.getTransactionCount(self.address)) self.nonce = max(self.nonce, w3.eth.getTransactionCount(self.address))
# Set minimum gasPrice to 1 Gwei, but allow more if the network says so. # Set minimum gasPrice to 1 Gwei, but allow more if the network says so.
details = { details = {
'chainId': w3.eth.chain_id(), 'chainId': w3.eth.chain_id,
'gasPrice': min(w3.toWei('1', 'gwei'), w3.eth.gasPrice), 'gasPrice': min(w3.toWei('1', 'gwei'), w3.eth.gasPrice),
'nonce': self.nonce, 'nonce': self.nonce,
'from': self.address, 'from': self.address,
......
...@@ -2,3 +2,4 @@ web3 ...@@ -2,3 +2,4 @@ web3
rusty-rlp rusty-rlp
ecdsa ecdsa
Crypto Crypto
dnspython
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment