From bbaba9f6af81cc19b15e40bede372ab1ff2ccfa7 Mon Sep 17 00:00:00 2001 From: Daniel Liu <139250065@qq.com> Date: Fri, 31 Oct 2025 14:56:22 +0800 Subject: [PATCH] core: fix too many goroutines in InitSignerInTransactions, close XFN-75 (#1662) --- core/state_processor.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/state_processor.go b/core/state_processor.go index c1ebd4e84b..d8bc5d6ad5 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -536,7 +536,10 @@ func ApplyEmptyTransaction(config *params.ChainConfig, statedb *state.StateDB, b } func InitSignerInTransactions(config *params.ChainConfig, header *types.Header, txs types.Transactions) { - nWorker := runtime.NumCPU() + if txs.Len() == 0 { + return + } + nWorker := min(runtime.NumCPU(), txs.Len()) signer := types.MakeSigner(config, header.Number) chunkSize := txs.Len() / nWorker if txs.Len()%nWorker != 0 {