mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 11:20:45 +00:00
Replaced goroutine with context.AfterFunc for cancellation.
This commit is contained in:
parent
51f73873f8
commit
86f576f5e8
1 changed files with 3 additions and 5 deletions
|
|
@ -262,11 +262,9 @@ func run(ctx context.Context, call *core.Message, opts *Options) (*core.Executio
|
|||
// context for the lifetime of this method call.
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
evm.Cancel()
|
||||
}()
|
||||
|
||||
context.AfterFunc(ctx, evm.Cancel)
|
||||
|
||||
// Execute the call, returning a wrapped error or the result
|
||||
result, err := core.ApplyMessage(evm, call, new(core.GasPool).AddGas(math.MaxUint64))
|
||||
if vmerr := dirtyState.Error(); vmerr != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue