From 6bc567bb1da35e5478c058277f8ebe05b8dc07fc Mon Sep 17 00:00:00 2001 From: Exqlnet <44158642+exqlnet@users.noreply.github.com> Date: Fri, 1 Mar 2024 00:56:07 +0800 Subject: [PATCH] Make node length definition more clearly --- merkletree.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/merkletree.go b/merkletree.go index 7ee6d78..cec53ad 100644 --- a/merkletree.go +++ b/merkletree.go @@ -177,7 +177,7 @@ func NewTree(params ...Parameter) (*MerkleTree, error) { branchesLen := int(math.Exp2(math.Ceil(math.Log2(float64(len(parameters.data)))))) // We pad our data length up to the power of 2. - nodes := make([][]byte, branchesLen+len(parameters.data)+(branchesLen-len(parameters.data))) + nodes := make([][]byte, branchesLen*2) // We put the leaves after the branches in the slice of nodes. createLeaves(