From f583b90ab077edc01cc9523c884b0223da69ed29 Mon Sep 17 00:00:00 2001 From: Nithish Karthik Date: Thu, 11 Apr 2024 22:16:41 +0530 Subject: [PATCH] reverse bytes --- src/mining/merkle_tree.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mining/merkle_tree.go b/src/mining/merkle_tree.go index da1eb4e..ba04374 100644 --- a/src/mining/merkle_tree.go +++ b/src/mining/merkle_tree.go @@ -86,7 +86,7 @@ func (s *rollingMerkleTreeStore) calcMerkleRoot(adds []*transaction.Transaction, var zeroHash [32]byte s.add(zeroHash) case witness: - s.add([32]byte(adds[i].WitnessHash())) + s.add([32]byte(utils.ReverseBytes(adds[i].WitnessHash()))) fmt.Printf("Witness Hash: %x", adds[i].WitnessHash()) default: s.add([32]byte(adds[i].TxHash())) @@ -102,7 +102,7 @@ func (s *rollingMerkleTreeStore) calcMerkleRoot(adds []*transaction.Transaction, if len(adds) > 0 && len(adds)%2 != 0 { switch { case witness: - s.add([32]byte(adds[len(adds)-1].WitnessHash())) + s.add([32]byte( utils.ReverseBytes(adds[len(adds)-1].WitnessHash()))) default: s.add([32]byte(adds[len(adds)-1].TxHash())) }