mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
Merge 048bc9b064 into f750117ad1
This commit is contained in:
commit
ba4784866f
2 changed files with 14 additions and 2 deletions
|
|
@ -28,6 +28,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/core/state"
|
"github.com/ethereum/go-ethereum/core/state"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
|
"github.com/ethereum/go-ethereum/eth/tracers"
|
||||||
"github.com/ethereum/go-ethereum/internal/ethapi"
|
"github.com/ethereum/go-ethereum/internal/ethapi"
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
|
|
@ -210,7 +211,8 @@ type storageEntry struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// StorageRangeAt returns the storage at the given block height and transaction index.
|
// StorageRangeAt returns the storage at the given block height and transaction index.
|
||||||
func (api *DebugAPI) StorageRangeAt(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash, txIndex int, contractAddress common.Address, keyStart hexutil.Bytes, maxResult int) (StorageRangeResult, error) {
|
// If txIndex is nil, it returns the storage at the end of the given block.
|
||||||
|
func (api *DebugAPI) StorageRangeAt(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash, txIndex *int, contractAddress common.Address, keyStart hexutil.Bytes, maxResult int) (StorageRangeResult, error) {
|
||||||
var block *types.Block
|
var block *types.Block
|
||||||
|
|
||||||
block, err := api.eth.APIBackend.BlockByNumberOrHash(ctx, blockNrOrHash)
|
block, err := api.eth.APIBackend.BlockByNumberOrHash(ctx, blockNrOrHash)
|
||||||
|
|
@ -220,7 +222,16 @@ func (api *DebugAPI) StorageRangeAt(ctx context.Context, blockNrOrHash rpc.Block
|
||||||
if block == nil {
|
if block == nil {
|
||||||
return StorageRangeResult{}, fmt.Errorf("block %v not found", blockNrOrHash)
|
return StorageRangeResult{}, fmt.Errorf("block %v not found", blockNrOrHash)
|
||||||
}
|
}
|
||||||
_, _, statedb, release, err := api.eth.stateAtTransaction(ctx, block, txIndex, 0)
|
|
||||||
|
var statedb *state.StateDB
|
||||||
|
var release tracers.StateReleaseFunc
|
||||||
|
|
||||||
|
if txIndex != nil {
|
||||||
|
_, _, statedb, release, err = api.eth.stateAtTransaction(ctx, block, *txIndex, 0)
|
||||||
|
} else {
|
||||||
|
statedb, release, err = api.eth.stateAtBlock(ctx, block, 0, nil, true, false)
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return StorageRangeResult{}, err
|
return StorageRangeResult{}, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -424,6 +424,7 @@ web3._extend({
|
||||||
name: 'storageRangeAt',
|
name: 'storageRangeAt',
|
||||||
call: 'debug_storageRangeAt',
|
call: 'debug_storageRangeAt',
|
||||||
params: 5,
|
params: 5,
|
||||||
|
inputFormatter: [null, null, null, null, null]
|
||||||
}),
|
}),
|
||||||
new web3._extend.Method({
|
new web3._extend.Method({
|
||||||
name: 'getModifiedAccountsByNumber',
|
name: 'getModifiedAccountsByNumber',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue