Skip to content

Commit

Permalink
fix: crash when waiting for a tx confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
banteg committed May 10, 2024
1 parent 4886600 commit 6af9717
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions brownie/network/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ def __init__(
# await confirmation of tx in a separate thread which is blocking if
# required_confs > 0 or tx has already confirmed (`blockNumber` != None)
confirm_thread = threading.Thread(
target=self._await_confirmation, args=(tx["blockNumber"], required_confs), daemon=True
target=self._await_confirmation, args=(tx.get("blockNumber"), required_confs), daemon=True
)
confirm_thread.start()
if is_blocking and (required_confs > 0 or tx["blockNumber"]):
if is_blocking and (required_confs > 0 or tx.get("blockNumber")):
confirm_thread.join()

def __repr__(self) -> str:
Expand Down Expand Up @@ -508,7 +508,7 @@ def _await_confirmation(self, block_number: int = None, required_confs: int = 1)
# check if tx is still in mempool, this will raise otherwise
tx = web3.eth.get_transaction(self.txid)
self.block_number = None
return self._await_confirmation(tx["blockNumber"], required_confs)
return self._await_confirmation(tx.get("blockNumber"), required_confs)
if required_confs - self.confirmations != remaining_confs:
remaining_confs = required_confs - self.confirmations
if not self._silent:
Expand Down

0 comments on commit 6af9717

Please sign in to comment.