mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-12 05:50:06 +00:00
correct iterate over items when goroutine inside loop (#2219)
This commit is contained in:
parent
59d05dc5fe
commit
24a76a002d
@ -641,8 +641,12 @@ func (s *Ethereum) Protocols() []p2p.Protocol {
|
||||
// Ethereum protocol implementation.
|
||||
func (s *Ethereum) Start() error {
|
||||
for i := range s.sentries {
|
||||
go download.RecvMessageLoop(s.downloadV2Ctx, s.sentries[i], s.downloadServer, nil)
|
||||
go download.RecvUploadMessageLoop(s.downloadV2Ctx, s.sentries[i], s.downloadServer, nil)
|
||||
go func(i int) {
|
||||
download.RecvMessageLoop(s.downloadV2Ctx, s.sentries[i], s.downloadServer, nil)
|
||||
}(i)
|
||||
go func(i int) {
|
||||
download.RecvUploadMessageLoop(s.downloadV2Ctx, s.sentries[i], s.downloadServer, nil)
|
||||
}(i)
|
||||
}
|
||||
|
||||
go Loop(s.downloadV2Ctx, s.chainKV, s.stagedSync2, s.downloadServer, s.events, s.config.StateStream, s.waitForStageLoopStop)
|
||||
|
@ -311,8 +311,10 @@ func NewStagedSync2(
|
||||
stagedsync.StageCallTracesCfg(db, 0, batchSize, tmpdir, controlServer.ChainConfig, controlServer.Engine),
|
||||
stagedsync.StageTxLookupCfg(db, tmpdir),
|
||||
stagedsync.StageTxPoolCfg(db, txPool, func() {
|
||||
for _, s := range txPoolServer.Sentries {
|
||||
go txpool.RecvTxMessageLoop(ctx, s, controlServer, txPoolServer.HandleInboundMessage, nil)
|
||||
for i := range txPoolServer.Sentries {
|
||||
go func(i int) {
|
||||
txpool.RecvTxMessageLoop(ctx, txPoolServer.Sentries[i], controlServer, txPoolServer.HandleInboundMessage, nil)
|
||||
}(i)
|
||||
}
|
||||
txPoolServer.TxFetcher.Start()
|
||||
}),
|
||||
|
Loading…
Reference in New Issue
Block a user