mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
eth: address some concerns (squash this)
This commit is contained in:
parent
3dd262f59d
commit
a37395332c
1 changed files with 13 additions and 5 deletions
18
eth/api.go
18
eth/api.go
|
|
@ -19,8 +19,8 @@ package eth
|
|||
import (
|
||||
"compress/gzip"
|
||||
"context"
|
||||
"errors"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math/big"
|
||||
|
|
@ -363,11 +363,19 @@ func accountRange(st state.Trie, start *common.Address, maxResult int) (AccountR
|
|||
return result, nil
|
||||
}
|
||||
|
||||
// enumerate all accounts in the latest state
|
||||
const (
|
||||
AccountRangeAtMaxResults = 256
|
||||
)
|
||||
|
||||
// AccountRangeAt enumerates all accounts in the latest state
|
||||
func (api *PrivateDebugAPI) AccountRangeAt(ctx context.Context, startAddr *common.Address, maxResults int) (AccountRangeResult, error) {
|
||||
var statedb *state.StateDB = nil
|
||||
var err error = nil
|
||||
var block = api.eth.blockchain.CurrentBlock()
|
||||
var statedb *state.StateDB
|
||||
var err error
|
||||
block := api.eth.blockchain.CurrentBlock()
|
||||
|
||||
if maxResults > AccountRangeAtMaxResults {
|
||||
maxResults = AccountRangeAtMaxResults
|
||||
}
|
||||
|
||||
if len(block.Transactions()) == 0 {
|
||||
parent := api.eth.blockchain.GetBlock(block.ParentHash(), block.NumberU64()-1)
|
||||
|
|
|
|||
Loading…
Reference in a new issue