triedb/pathdb: compute size in StateSetWithOrigin.decode (#34828)
Some checks are pending
/ Linux Build (push) Waiting to run
/ Linux Build (arm) (push) Waiting to run
/ Keeper Build (push) Waiting to run
/ Windows Build (push) Waiting to run
/ Docker Image (push) Waiting to run

`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:
Rahman 2026-04-27 01:25:57 -06:00 committed by GitHub
parent 2d5da60371
commit a065580422
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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
}