mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
rpc: allow nil as a start hash param
This commit is contained in:
parent
8efbf2134d
commit
0e5dcefc0e
2 changed files with 6 additions and 0 deletions
|
|
@ -344,6 +344,9 @@ type AccountRangeResult struct {
|
|||
}
|
||||
|
||||
func accountRange(st state.Trie, start *common.Hash, maxResults int) (AccountRangeResult, error) {
|
||||
if start == nil {
|
||||
start = &common.Hash{0}
|
||||
}
|
||||
it := trie.NewIterator(st.NodeIterator(start.Bytes()))
|
||||
result := AccountRangeResult{Accounts: make(map[common.Hash]*common.Address), Next: common.Hash{}}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,6 +88,9 @@ func TestAccountRange(t *testing.T) {
|
|||
t.Logf("test getting number of results greater than max %d", AccountRangeMaxResults)
|
||||
accountRangeTest(t, &trie, state, &common.Hash{0x0}, AccountRangeMaxResults*2, AccountRangeMaxResults)
|
||||
|
||||
t.Logf("test with empty 'start' hash")
|
||||
accountRangeTest(t, &trie, state, nil, AccountRangeMaxResults, AccountRangeMaxResults)
|
||||
|
||||
t.Logf("test pagination")
|
||||
|
||||
// test pagination
|
||||
|
|
|
|||
Loading…
Reference in a new issue