mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 12:46:44 +00:00
trie/bintrie: deserialize zero hashes as Empty nodes instead of HashedNode
This commit is contained in:
parent
b04df226fa
commit
47f4e5625a
1 changed files with 9 additions and 2 deletions
|
|
@ -101,10 +101,17 @@ func DeserializeNode(serialized []byte, depth int) (BinaryNode, error) {
|
|||
if len(serialized) != 65 {
|
||||
return nil, invalidSerializedLength
|
||||
}
|
||||
var left, right BinaryNode = Empty{}, Empty{}
|
||||
if leftHash := common.BytesToHash(serialized[1:33]); leftHash != (common.Hash{}) {
|
||||
left = HashedNode(leftHash)
|
||||
}
|
||||
if rightHash := common.BytesToHash(serialized[33:65]); rightHash != (common.Hash{}) {
|
||||
right = HashedNode(rightHash)
|
||||
}
|
||||
return &InternalNode{
|
||||
depth: depth,
|
||||
left: HashedNode(common.BytesToHash(serialized[1:33])),
|
||||
right: HashedNode(common.BytesToHash(serialized[33:65])),
|
||||
left: left,
|
||||
right: right,
|
||||
}, nil
|
||||
case nodeTypeStem:
|
||||
if len(serialized) < 64 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue