mpt: move empty hash node in a separate type

We use them quite frequently (consider children for a new branch
node) and it is better to get rid of unneeded allocations.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgeniy Stratonikov 2021-08-03 17:10:46 +03:00
parent f02d8b4ec4
commit db80ef28df
11 changed files with 124 additions and 99 deletions

View file

@ -27,7 +27,7 @@ var _ Node = (*BranchNode)(nil)
func NewBranchNode() *BranchNode {
b := new(BranchNode)
for i := 0; i < childrenCount; i++ {
b.Children[i] = new(HashNode)
b.Children[i] = EmptyNode{}
}
return b
}