From a06558042299eba2e19ca656d3f46edb85df1420 Mon Sep 17 00:00:00 2001 From: Rahman Date: Mon, 27 Apr 2026 01:25:57 -0600 Subject: [PATCH] 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()`. --- triedb/pathdb/states.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/triedb/pathdb/states.go b/triedb/pathdb/states.go index c54d8b1136..27a6c1d422 100644 --- a/triedb/pathdb/states.go +++ b/triedb/pathdb/states.go @@ -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 }