Skip to content

Commit

Permalink
The default chainHash is 00000s not nil, so instead we check against …
Browse files Browse the repository at this point in the history
…nil here.

Signed-off-by: Darren Kellenschwiler <[email protected]>
  • Loading branch information
sirdeggen committed Nov 7, 2023
1 parent 8fde7dc commit 2fa06a0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions merkleroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ func BuildMerkleTreeStoreChainHash(txids []*chainhash.Hash) ([]*chainhash.Hash,
for i := 0; i < arraySize-1; i += 2 {
switch {
// When there is no left child node, the parent is nil ("") too.
case merkles[i].IsEqual(&chainhash.Hash{}):
merkles[offset] = &chainhash.Hash{}
case merkles[i].IsEqual(nil):
merkles[offset] = nil

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

// The normal case sets the parent node to the double sha256
Expand Down

0 comments on commit 2fa06a0

Please sign in to comment.