Skip to content

Commit 6af9717

Browse files
committed
fix: crash when waiting for a tx confirmation
1 parent 4886600 commit 6af9717

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

brownie/network/transaction.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,10 @@ def __init__(
216216
# await confirmation of tx in a separate thread which is blocking if
217217
# required_confs > 0 or tx has already confirmed (`blockNumber` != None)
218218
confirm_thread = threading.Thread(
219-
target=self._await_confirmation, args=(tx["blockNumber"], required_confs), daemon=True
219+
target=self._await_confirmation, args=(tx.get("blockNumber"), required_confs), daemon=True
220220
)
221221
confirm_thread.start()
222-
if is_blocking and (required_confs > 0 or tx["blockNumber"]):
222+
if is_blocking and (required_confs > 0 or tx.get("blockNumber")):
223223
confirm_thread.join()
224224

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

0 commit comments

Comments
 (0)