mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-04 22:18:40 +00:00
triedb/pathdb: compute size in StateSetWithOrigin.decode (#34828)
`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:
parent
2d5da60371
commit
a065580422
1 changed files with 12 additions and 0 deletions
|
|
@ -583,6 +583,18 @@ func (s *StateSetWithOrigin) decode(r *rlp.Stream) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s.storageOrigin = storageSet
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue