Skip to content

Commit

Permalink
Use DefaultThresholdNLeafs if cfg.ThresholdNLeafs is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaucube committed Dec 17, 2021
1 parent 96ccfdb commit d56ab85
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d56ab85

Please sign in to comment.