certichain

Blockchain built from scratch for verifying document's legitimacy.
Log | Files | Refs | README | LICENSE

commit 10cfa01551aec1d83cc5ea59070f9d87a201aa93
parent 36fc8f9d3f9784724ad3e58ffe56aa587265a894
Author: Shivakumar <[email protected]>
Date:   Thu, 30 Jul 2026 23:45:15 +0530

feat(transaction): nil cases check for Compare

Signed-off-by: Shivakumar <[email protected]>

Diffstat:
Minternal/transaction/transaction.go | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/internal/transaction/transaction.go b/internal/transaction/transaction.go @@ -177,6 +177,14 @@ func (tx *Transaction) Equal(other *Transaction) bool { // Compare compares two Transactions for ordering. func Compare(a, b *Transaction) int { + switch { + case a == nil && b == nil: + return 0 + case a == nil: + return -1 + case b == nil: + return 1 + } if c := cmp.Compare(a.Timestamp, b.Timestamp); c != 0 { return c }