From 86f576f5e85aa8f6441a7f4b731964cdcb478d5f Mon Sep 17 00:00:00 2001 From: Klimov Sergei Date: Sat, 7 Feb 2026 08:48:20 +0800 Subject: [PATCH] Replaced goroutine with context.AfterFunc for cancellation. --- eth/gasestimator/gasestimator.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/eth/gasestimator/gasestimator.go b/eth/gasestimator/gasestimator.go index 6e79fbd62b..ffad83e678 100644 --- a/eth/gasestimator/gasestimator.go +++ b/eth/gasestimator/gasestimator.go @@ -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 {