trie/bintrie: use EmptyRef for zero-hash children in deserialization

This commit is contained in:
CPerezz 2026-04-15 22:50:04 +02:00
parent cff5fca22f
commit d5969de518
No known key found for this signature in database
GPG key ID: 62045F34B97177DD

View file

@ -156,8 +156,13 @@ func (s *NodeStore) deserializeNode(serialized []byte, depth int, hn common.Hash
copy(leftHash[:], serialized[NodeTypeBytes:NodeTypeBytes+HashSize])
copy(rightHash[:], serialized[NodeTypeBytes+HashSize:])
leftRef := s.newHashedRef(leftHash)
rightRef := s.newHashedRef(rightHash)
var leftRef, rightRef NodeRef
if leftHash != (common.Hash{}) {
leftRef = s.newHashedRef(leftHash)
}
if rightHash != (common.Hash{}) {
rightRef = s.newHashedRef(rightHash)
}
ref := s.newInternalRef(depth)
node := s.getInternal(ref.Index())