Use DefaultThresholdNLeafs if cfg.ThresholdNLeafs is not defined
arnaucube root@arnaucube.com
Fri, 17 Dec 2021 09:57:03 +0100
1 files changed,
3 insertions(+),
0 deletions(-)
jump to
M
tree.go
→
tree.go
@@ -132,6 +132,9 @@ // be ccommited inside this method, if there is a Tree still in the given
// 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