fix: add with base

This commit is contained in:
jsvisa 2025-08-25 08:45:52 +08:00 committed by Gary Rong
parent db070e667b
commit 9a3a6c72e2

View file

@ -83,21 +83,20 @@ type SizeStats struct {
// add applies the given state diffs and produces a new version of the statistics. // add applies the given state diffs and produces a new version of the statistics.
func (s SizeStats) add(diff SizeStats) SizeStats { func (s SizeStats) add(diff SizeStats) SizeStats {
var combo SizeStats s.StateRoot = diff.StateRoot
combo.StateRoot = diff.StateRoot s.BlockNumber = diff.BlockNumber
combo.BlockNumber = diff.BlockNumber
combo.Accounts += diff.Accounts s.Accounts += diff.Accounts
combo.AccountBytes += diff.AccountBytes s.AccountBytes += diff.AccountBytes
combo.Storages += diff.Storages s.Storages += diff.Storages
combo.StorageBytes += diff.StorageBytes s.StorageBytes += diff.StorageBytes
combo.AccountTrienodes += diff.AccountTrienodes s.AccountTrienodes += diff.AccountTrienodes
combo.AccountTrienodeBytes += diff.AccountTrienodeBytes s.AccountTrienodeBytes += diff.AccountTrienodeBytes
combo.StorageTrienodes += diff.StorageTrienodes s.StorageTrienodes += diff.StorageTrienodes
combo.StorageTrienodeBytes += diff.StorageTrienodeBytes s.StorageTrienodeBytes += diff.StorageTrienodeBytes
combo.ContractCodes += diff.ContractCodes s.ContractCodes += diff.ContractCodes
combo.ContractCodeBytes += diff.ContractCodeBytes s.ContractCodeBytes += diff.ContractCodeBytes
return combo return s
} }
// calSizeStats measures the state size changes of the provided state update. // calSizeStats measures the state size changes of the provided state update.