mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 10:50:44 +00:00
eth, internal: add console endpoint
This commit is contained in:
parent
e70d87274f
commit
287a55072a
2 changed files with 8 additions and 29 deletions
|
|
@ -494,9 +494,9 @@ func (api *DebugAPI) StateSize(blockHashOrNumber *rpc.BlockNumberOrHash) (interf
|
|||
}, nil
|
||||
}
|
||||
|
||||
func (api *DebugAPI) ExecutionWitness(bn rpc.BlockNumber) (*stateless.ExtWitness, error) {
|
||||
func (api *DebugAPI) ExecutionWitness(bn rpc.BlockNumberOrHash) (*stateless.ExtWitness, error) {
|
||||
bc := api.eth.blockchain
|
||||
block, err := api.eth.APIBackend.BlockByNumber(context.Background(), bn)
|
||||
block, err := api.eth.APIBackend.BlockByNumberOrHash(context.Background(), bn)
|
||||
if err != nil {
|
||||
return &stateless.ExtWitness{}, fmt.Errorf("block number %v not found", bn)
|
||||
}
|
||||
|
|
@ -515,25 +515,3 @@ func (api *DebugAPI) ExecutionWitness(bn rpc.BlockNumber) (*stateless.ExtWitness
|
|||
}
|
||||
return result.Witness().ToExtWitness(), nil
|
||||
}
|
||||
|
||||
func (api *DebugAPI) ExecutionWitnessByHash(hash common.Hash) (*stateless.ExtWitness, error) {
|
||||
bc := api.eth.blockchain
|
||||
block := bc.GetBlockByHash(hash)
|
||||
if block == nil {
|
||||
return &stateless.ExtWitness{}, fmt.Errorf("block hash %x not found", hash)
|
||||
}
|
||||
parent := bc.GetHeader(block.ParentHash(), block.NumberU64()-1)
|
||||
if parent == nil {
|
||||
return &stateless.ExtWitness{}, fmt.Errorf("block number %x found, but parent missing", hash)
|
||||
}
|
||||
config := core.ExecuteConfig{
|
||||
WriteState: false,
|
||||
EnableTracer: false,
|
||||
MakeWitness: true,
|
||||
}
|
||||
result, err := bc.ProcessBlock(context.Background(), parent.Root, block, config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.Witness().ToExtWitness(), nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -427,11 +427,6 @@ web3._extend({
|
|||
params: 2,
|
||||
inputFormatter:[null, null],
|
||||
}),
|
||||
new web3._extend.Method({
|
||||
name: 'freezeClient',
|
||||
call: 'debug_freezeClient',
|
||||
params: 1,
|
||||
}),
|
||||
new web3._extend.Method({
|
||||
name: 'getAccessibleState',
|
||||
call: 'debug_getAccessibleState',
|
||||
|
|
@ -474,6 +469,12 @@ web3._extend({
|
|||
params: 1,
|
||||
inputFormatter: [null],
|
||||
}),
|
||||
new web3._extend.Method({
|
||||
name: 'executionWitness',
|
||||
call: 'debug_executionWitness',
|
||||
params: 1,
|
||||
inputFormatter: [null],
|
||||
}),
|
||||
],
|
||||
properties: []
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue