From d56ab859f109acd5b7a72211e295d687eded7262 Mon Sep 17 00:00:00 2001 From: arnaucube Date: Fri, 17 Dec 2021 09:57:03 +0100 Subject: [PATCH] Use DefaultThresholdNLeafs if cfg.ThresholdNLeafs is not defined --- tree.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tree.go b/tree.go index 5836f68..ef1b830 100644 --- a/tree.go +++ b/tree.go @@ -132,6 +132,9 @@ func NewTree(cfg Config) (*Tree, error) { // database, it will load it. func NewTreeWithTx(wTx db.WriteTx, cfg Config) (*Tree, error) { // if thresholdNLeafs is set to 0, use the DefaultThresholdNLeafs + if cfg.ThresholdNLeafs == 0 { + cfg.ThresholdNLeafs = DefaultThresholdNLeafs + } t := Tree{db: cfg.Database, maxLevels: cfg.MaxLevels, thresholdNLeafs: cfg.ThresholdNLeafs, hashFunction: cfg.HashFunction} t.emptyHash = make([]byte, t.hashFunction.Len()) // empty