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 (
|
import (
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
@ -363,11 +363,19 @@ func accountRange(st state.Trie, start *common.Address, maxResult int) (AccountR
|
||||||
return result, nil
|
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) {
|
func (api *PrivateDebugAPI) AccountRangeAt(ctx context.Context, startAddr *common.Address, maxResults int) (AccountRangeResult, error) {
|
||||||
var statedb *state.StateDB = nil
|
var statedb *state.StateDB
|
||||||
var err error = nil
|
var err error
|
||||||
var block = api.eth.blockchain.CurrentBlock()
|
block := api.eth.blockchain.CurrentBlock()
|
||||||
|
|
||||||
|
if maxResults > AccountRangeAtMaxResults {
|
||||||
|
maxResults = AccountRangeAtMaxResults
|
||||||
|
}
|
||||||
|
|
||||||
if len(block.Transactions()) == 0 {
|
if len(block.Transactions()) == 0 {
|
||||||
parent := api.eth.blockchain.GetBlock(block.ParentHash(), block.NumberU64()-1)
|
parent := api.eth.blockchain.GetBlock(block.ParentHash(), block.NumberU64()-1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue