From edcf1f831162e2d72c49f1fcdc4222c009838e04 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Sun, 24 Dec 2023 16:26:10 -0300 Subject: [PATCH] add: 'eq' and 'repr' in node class --- merkly/node.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/merkly/node.py b/merkly/node.py index 838197c..0931a19 100644 --- a/merkly/node.py +++ b/merkly/node.py @@ -13,5 +13,11 @@ class Node(BaseModel): # 🍃 Leaf of Merkle Tree """ - data: Optional[str] = None + data: Optional[bytes] = None side: Side = Side.LEFT + + def __eq__(self, other: "Node") -> bool: + return self.data == other.data + + def __repr__(self) -> str: + return f"Node({self.data.hex()}, {self.side})"