Add thresholdNLeafs configurable

ThresholdNLeafs defines the threshold number of leafs in the tree that
determines if AddBatch will work in memory or in disk. It is defined
when calling NewTree, and if set to 0 it will work always in disk.
This commit is contained in:
arnaucube
2021-11-22 21:09:16 +01:00
parent 6cf1e58d9f
commit 4b6d6efdca
8 changed files with 172 additions and 86 deletions

View File

@@ -77,7 +77,9 @@ func (f HashPoseidon) Len() int {
return 32 //nolint:gomnd
}
// Hash implements the hash method for the HashFunction HashPoseidon
// Hash implements the hash method for the HashFunction HashPoseidon. It
// expects the byte arrays to be little-endian representations of big.Int
// values.
func (f HashPoseidon) Hash(b ...[]byte) ([]byte, error) {
var toHash []*big.Int
for i := 0; i < len(b); i++ {