[ethereum/go-ethereum] Add AccountRangeAt to debug API (#17438)

jwasinger commented on this pull request.

> @@ -346,6 +347,36 @@ func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]*BadBlockArgs,
return results, nil
}

+type AccountRangeAtResult struct {
+ result []common.Hash `json:»result»`
+}
+
+func accountRangeAt(st state.Trie, start *common.Hash, maxResult int) (AccountRangeAtResult, error) {
+ it := trie.NewIterator(st.NodeIterator(start[:]))
+ result := []common.Hash{}
+ for i := 0; i < maxResult && it.Next(); i++ { + result = append(result, common.BytesToHash(it.Key)) + } + return AccountRangeAtResult{result}, nil +} + +//block hash or number, tx index, start address hash, max results +func (api *PrivateDebugAPI) AccountRangeAt(ctx context.Context, blockNr uint64, txIndex int, startAddr *common.Hash, maxResults int) (AccountRangeAtResult, error) { I think you're right.

Добавить комментарий