Skip to content

Commit 2fa06a0

Browse files
committed
The default chainHash is 00000s not nil, so instead we check against nil here.
Signed-off-by: Darren Kellenschwiler <[email protected]>
1 parent 8fde7dc commit 2fa06a0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

merkleroot.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ func BuildMerkleTreeStoreChainHash(txids []*chainhash.Hash) ([]*chainhash.Hash,
145145
for i := 0; i < arraySize-1; i += 2 {
146146
switch {
147147
// When there is no left child node, the parent is nil ("") too.
148-
case merkles[i].IsEqual(&chainhash.Hash{}):
149-
merkles[offset] = &chainhash.Hash{}
148+
case merkles[i].IsEqual(nil):
149+
merkles[offset] = nil
150150

151151
// When there is no right child, the parent is generated by
152152
// hashing the concatenation of the left child with itself.
153-
case merkles[i+1].IsEqual(&chainhash.Hash{}):
153+
case merkles[i+1].IsEqual(nil):
154154
merkles[offset] = MerkleTreeParentBytes(merkles[i], merkles[i])
155155

156156
// The normal case sets the parent node to the double sha256

0 commit comments

Comments
 (0)