Replaced goroutine with context.AfterFunc for cancellation.

This commit is contained in:
Klimov Sergei 2026-02-07 08:48:20 +08:00 committed by GitHub
parent 51f73873f8
commit 86f576f5e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 {