mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-12 01:41:36 +00:00
trie/bintrie: use EmptyRef for zero-hash children in deserialization
This commit is contained in:
parent
cff5fca22f
commit
d5969de518
1 changed files with 7 additions and 2 deletions
|
|
@ -156,8 +156,13 @@ func (s *NodeStore) deserializeNode(serialized []byte, depth int, hn common.Hash
|
||||||
copy(leftHash[:], serialized[NodeTypeBytes:NodeTypeBytes+HashSize])
|
copy(leftHash[:], serialized[NodeTypeBytes:NodeTypeBytes+HashSize])
|
||||||
copy(rightHash[:], serialized[NodeTypeBytes+HashSize:])
|
copy(rightHash[:], serialized[NodeTypeBytes+HashSize:])
|
||||||
|
|
||||||
leftRef := s.newHashedRef(leftHash)
|
var leftRef, rightRef NodeRef
|
||||||
rightRef := s.newHashedRef(rightHash)
|
if leftHash != (common.Hash{}) {
|
||||||
|
leftRef = s.newHashedRef(leftHash)
|
||||||
|
}
|
||||||
|
if rightHash != (common.Hash{}) {
|
||||||
|
rightRef = s.newHashedRef(rightHash)
|
||||||
|
}
|
||||||
|
|
||||||
ref := s.newInternalRef(depth)
|
ref := s.newInternalRef(depth)
|
||||||
node := s.getInternal(ref.Index())
|
node := s.getInternal(ref.Index())
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue