mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
internal/ethapi: abort when context is cancelled
This commit is contained in:
parent
62058060cb
commit
098a448cd8
1 changed files with 6 additions and 0 deletions
|
|
@ -96,6 +96,9 @@ type simulator struct {
|
||||||
|
|
||||||
// execute runs the simulation of a series of blocks.
|
// execute runs the simulation of a series of blocks.
|
||||||
func (sim *simulator) execute(ctx context.Context, blocks []simBlock) ([]map[string]interface{}, error) {
|
func (sim *simulator) execute(ctx context.Context, blocks []simBlock) ([]map[string]interface{}, error) {
|
||||||
|
if err := ctx.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
var (
|
var (
|
||||||
cancel context.CancelFunc
|
cancel context.CancelFunc
|
||||||
timeout = sim.b.RPCEVMTimeout()
|
timeout = sim.b.RPCEVMTimeout()
|
||||||
|
|
@ -194,6 +197,9 @@ func (sim *simulator) processBlock(ctx context.Context, block *simBlock, header,
|
||||||
evm.SetPrecompiles(precompiles)
|
evm.SetPrecompiles(precompiles)
|
||||||
}
|
}
|
||||||
for i, call := range block.Calls {
|
for i, call := range block.Calls {
|
||||||
|
if err := ctx.Err(); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
if err := sim.sanitizeCall(&call, sim.state, header, blockContext, &gasUsed); err != nil {
|
if err := sim.sanitizeCall(&call, sim.state, header, blockContext, &gasUsed); err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue