This commit is contained in:
yyhrnk 2025-12-11 08:32:03 +02:00 committed by GitHub
parent 82fa9a4268
commit 8f3f0ab650
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -63,12 +63,15 @@ func (s *WitnessStats) Add(nodes map[string][]byte, owner common.Hash) {
// The last path is always a leaf. // The last path is always a leaf.
if i == len(paths)-1 || !strings.HasPrefix(paths[i+1], paths[i]) { if i == len(paths)-1 || !strings.HasPrefix(paths[i+1], paths[i]) {
depth := len(path) depth := len(path)
if owner == (common.Hash{}) {
if depth >= len(s.accountTrieLeaves) { if depth >= len(s.accountTrieLeaves) {
depth = len(s.accountTrieLeaves) - 1 depth = len(s.accountTrieLeaves) - 1
} }
if owner == (common.Hash{}) {
s.accountTrieLeaves[depth] += 1 s.accountTrieLeaves[depth] += 1
} else { } else {
if depth >= len(s.storageTrieLeaves) {
depth = len(s.storageTrieLeaves) - 1
}
s.storageTrieLeaves[depth] += 1 s.storageTrieLeaves[depth] += 1
} }
} }