fix: include start key

Update api_debug.go
This commit is contained in:
suha jin 2025-05-20 17:29:23 +09:00
parent 24771fdba4
commit f64d701014

View file

@ -245,7 +245,7 @@ func storageRangeAt(statedb *state.StateDB, root common.Hash, address common.Add
} }
it := trie.NewIterator(trieIt) it := trie.NewIterator(trieIt)
result := StorageRangeResult{Storage: storageMap{}} result := StorageRangeResult{Storage: storageMap{}}
for i := 0; i < maxResult && it.Next(); i++ { for range maxResult {
_, content, _, err := rlp.Split(it.Value) _, content, _, err := rlp.Split(it.Value)
if err != nil { if err != nil {
return StorageRangeResult{}, err return StorageRangeResult{}, err
@ -256,6 +256,9 @@ func storageRangeAt(statedb *state.StateDB, root common.Hash, address common.Add
e.Key = &preimage e.Key = &preimage
} }
result.Storage[common.BytesToHash(it.Key)] = e result.Storage[common.BytesToHash(it.Key)] = e
if !it.Next() {
break
}
} }
// Add the 'next key' so clients can continue downloading. // Add the 'next key' so clients can continue downloading.
if it.Next() { if it.Next() {