non blocking broadcast of new txs (#292)

This commit is contained in:
Alex Sharov 2022-02-01 19:16:43 +07:00 committed by GitHub
parent 1cc07746a4
commit 74d49a9de1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1324,7 +1324,9 @@ func MainLoop(ctx context.Context, db kv.RwDB, coreDB kv.RoDB, p *TxPool, newTxs
log.Debug("[txpool] Commit", "written_kb", written/1024, "in", time.Since(t))
}
case h := <-newTxs:
go func() {
t := time.Now()
notifyMiningAboutNewSlots()
localTxHashes = localTxHashes[:0]
localTxRlps = localTxRlps[:0]
@ -1368,6 +1370,7 @@ func MainLoop(ctx context.Context, db kv.RwDB, coreDB kv.RoDB, p *TxPool, newTxs
send.BroadcastPooledTxs(remoteTxRlps)
send.AnnouncePooledTxs(remoteTxHashes)
propagateNewTxsTimer.UpdateDuration(t)
}()
case <-syncToNewPeersEvery.C: // new peer
newPeers := p.recentlyConnectedPeers.GetAndClean()
if len(newPeers) == 0 {