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 d86e88f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ledgereth/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ 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 d86e88f

Please sign in to comment.