triedb/pathdb: compute size in StateSetWithOrigin.decode

`StateSetWithOrigin.decode()` was missing size computation after deserializing origin data, causing `size` to remain zero after journal reload. Added the same calculation logic used in `NewStateSetWithOrigin()`.
This commit is contained in:
Tanvir 2026-04-27 00:48:23 +08:00
parent 2d5da60371
commit 970c427c15

View file

@ -583,6 +583,18 @@ func (s *StateSetWithOrigin) decode(r *rlp.Stream) error {
}
}
s.storageOrigin = storageSet
// Compute the size of origin data, keeping consistent with NewStateSetWithOrigin
var size int
for _, data := range s.accountOrigin {
size += common.HashLength + len(data)
}
for _, slots := range s.storageOrigin {
for _, data := range slots {
size += 2*common.HashLength + len(data)
}
}
s.size = s.stateSet.size + uint64(size)
return nil
}