mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
core: fix too many goroutines in InitSignerInTransactions, close XFN-75 (#1662)
This commit is contained in:
parent
a5e68b9c52
commit
336d1f9f34
1 changed files with 4 additions and 1 deletions
|
|
@ -569,7 +569,10 @@ func ApplyEmptyTransaction(config *params.ChainConfig, statedb *state.StateDB, b
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitSignerInTransactions(config *params.ChainConfig, header *types.Header, txs types.Transactions) {
|
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)
|
signer := types.MakeSigner(config, header.Number)
|
||||||
chunkSize := txs.Len() / nWorker
|
chunkSize := txs.Len() / nWorker
|
||||||
if txs.Len()%nWorker != 0 {
|
if txs.Len()%nWorker != 0 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue