Skip to content

Commit

Permalink
Add serialization/deserialization test for FaultedTx. May/may not rea…
Browse files Browse the repository at this point in the history
…lly be needed since it isn't tracked by the tracker. In any case because we sub-class from AsyncTx we test it anyway since implemented.
  • Loading branch information
derekpierre committed Mar 8, 2024
1 parent 2b52a48 commit e1f312e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ def test_fault(eip1559_transaction, legacy_transaction, mocker):
# no active tx
assert tx_tracker.pending is None

# serialization/deserialization of FaultedTx - not tracked so not done anywhere else
deserialized_fault_tx = FaultedTx.from_dict(tx.to_dict())
assert deserialized_fault_tx == tx
assert hash(deserialized_fault_tx) == hash(tx)

# repeat with no hook
tx_hash_2 = TxHash("0xdeadbeef2")
assert tx_tracker.pop() == tx_2
Expand All @@ -268,6 +273,14 @@ def test_fault(eip1559_transaction, legacy_transaction, mocker):
# no active tx
assert tx_tracker.pending is None

# serialization/deserialization of FaultedTx - not tracked so not done anywhere else
deserialized_fault_tx_2 = FaultedTx.from_dict(tx_2.to_dict())
assert deserialized_fault_tx_2 == tx_2
assert hash(deserialized_fault_tx_2) == hash(tx_2)

assert tx_2 != tx
assert hash(tx_2) != hash(tx)


def test_update_after_retry(eip1559_transaction, legacy_transaction, mocker):
tx_tracker = _TxTracker(disk_cache=False)
Expand Down

0 comments on commit e1f312e

Please sign in to comment.