Skip to content

Commit

Permalink
Add __eq__ and __hash__ methods for LedgerAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
moisses89 committed Nov 13, 2023
1 parent 884a25b commit 56aa97b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ledgereth/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ def __init__(self, path, address):
def __repr__(self):
return f"<ledgereth.objects.LedgerAccount {self.address}>"

def __eq__(self, other):
if isinstance(other, LedgerAccount):
return self.path == other.path and self.address == other.address
return False

def __hash__(self):
return hash((self.path, self.address))

class SerializableTransaction(Serializable):
"""An RLP Serializable transaction object"""
Expand Down

0 comments on commit 56aa97b

Please sign in to comment.