Refactor context cancellation for EVM execution

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

View file

@ -741,10 +741,7 @@ func applyMessage(ctx context.Context, b Backend, args TransactionArgs, state *s
func applyMessageWithEVM(ctx context.Context, evm *vm.EVM, msg *core.Message, timeout time.Duration, gp *core.GasPool) (*core.ExecutionResult, error) {
// Wait for the context to be done and cancel the evm. Even if the
// EVM has finished, cancelling may be done (repeatedly)
go func() {
<-ctx.Done()
evm.Cancel()
}()
context.AfterFunc(ctx, evm.Cancel)
// Execute the message.
result, err := core.ApplyMessage(evm, msg, gp)