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

@ -68,7 +68,7 @@ func (n *NodeObject) UnmarshalJSON(data []byte) error {
switch len(m) {
case 0:
n.Node = new(HashNode)
n.Node = EmptyNode{}
case 1:
if v, ok := m["hash"]; ok {
var h util.Uint256