From bfbcfd1fe2bd893f9708768a8f4487a912f28015 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Fri, 31 Aug 2018 22:09:49 -0400 Subject: [PATCH] Improve mutability testing --- merkle.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/merkle.go b/merkle.go index f0a77f9..2f02071 100644 --- a/merkle.go +++ b/merkle.go @@ -248,10 +248,12 @@ func (mt MerkleTree) findLeaf(block Block) (int, error) { j := len(mt.nodes) - len(mt.blocks) // contains possible leaf index range // attempt to find the leaf corresponding to the block - for i < len(mt.blocks) && j < len(mt.nodes) && leaf == nil { + for i < len(mt.blocks) { if bytes.Equal(mt.blocks[i].Bytes(), block.Bytes()) { leaf = mt.nodes[j] leafIdx = j + + break } i++ @@ -282,8 +284,6 @@ func hashNode(data []byte, internal bool) Node { if internal { raw[0] = byte(internalNodePrefix) - } else { - raw[0] = byte(leafNodePrefix) } copy(raw[1:], data)