Skip to content

Commit

Permalink
fix: minor bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdefinitelyahuman committed Nov 16, 2020
1 parent ef409e0 commit 7f866db
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions brownie/network/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class TransactionReceipt:
logs = None
nonce = None
sender = None
txid = None
txid: str
txindex = None

def __init__(
Expand Down Expand Up @@ -163,7 +163,7 @@ def __init__(
# attributes that can be set immediately
self.sender = sender
self.status = Status(-1)
self.txid = txid
self.txid = str(txid)
self.contract_name = None
self.fn_name = name

Expand Down Expand Up @@ -336,14 +336,14 @@ def _await_transaction(self, required_confs: int, is_blocking: bool) -> None:
# await tx showing in mempool
while True:
try:
tx: Dict = web3.eth.getTransaction(self.txid)
tx: Dict = web3.eth.getTransaction(HexBytes(self.txid))
break
except TransactionNotFound:
except (TransactionNotFound, ValueError):
if self.sender is None:
# if sender was not explicitly set, this transaction was
# not broadcasted locally and so likely doesn't exist
raise
if self.sender.nonce > self.nonce:
if self.nonce is not None and self.sender.nonce > self.nonce:
self.status = Status(-2)
return
time.sleep(1)
Expand Down Expand Up @@ -380,7 +380,9 @@ def _await_confirmation(self, tx: Dict, required_confs: int = 1) -> None:
# if sender nonce is greater than tx nonce, the tx should be confirmed
expect_confirmed = bool(self.sender.nonce > self.nonce) # type: ignore
try:
receipt = web3.eth.waitForTransactionReceipt(self.txid, timeout=30, poll_latency=1)
receipt = web3.eth.waitForTransactionReceipt(
HexBytes(self.txid), timeout=30, poll_latency=1
)
break
except TimeExhausted:
if expect_confirmed:
Expand Down

0 comments on commit 7f866db

Please sign in to comment.