File tree Expand file tree Collapse file tree 2 files changed +5
-14
lines changed Expand file tree Collapse file tree 2 files changed +5
-14
lines changed Original file line number Diff line number Diff line change @@ -17,16 +17,6 @@ import (
1717)
1818
1919const (
20- // waitBlockTime is the amount of time to wait for BuildBlock to be
21- // called by the engine before deciding whether or not to gossip the
22- // transaction that triggered the PendingTxs message to the engine.
23- //
24- // This is done to reduce contention in the network when there is no
25- // preferred producer. If we did not wait here, we may gossip a new
26- // transaction to a peer while building a block that will conflict with
27- // whatever the peer makes.
28- waitBlockTime = 100 * time .Millisecond
29-
3020 // Minimum amount of time to wait after building a block before attempting to build a block
3121 // a second time without changing the contents of the mempool.
3222 minBlockBuildingRetryDelay = 500 * time .Millisecond
@@ -166,9 +156,6 @@ func (b *blockBuilder) awaitSubmittedTxs() {
166156 b .signalTxsReady ()
167157
168158 if b .gossiper != nil && len (ethTxsEvent .Txs ) > 0 {
169- // Give time for this node to build a block before attempting to
170- // gossip
171- time .Sleep (waitBlockTime )
172159 // [GossipTxs] will block unless [gossiper.txsToGossipChan] (an
173160 // unbuffered channel) is listened on
174161 if err := b .gossiper .GossipTxs (ethTxsEvent .Txs ); err != nil {
Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ const (
3434 // [txsGossipInterval] is how often we attempt to gossip newly seen
3535 // transactions to other nodes.
3636 txsGossipInterval = 500 * time .Millisecond
37+
38+ // [minGossipBatchInterval] is the minimum amount of time that must pass
39+ // before our last gossip to peers.
40+ minGossipBatchInterval = 50 * time .Millisecond
3741)
3842
3943// Gossiper handles outgoing gossip of transactions
@@ -323,7 +327,7 @@ func (n *pushGossiper) sendTxs(txs []*types.Transaction) error {
323327}
324328
325329func (n * pushGossiper ) gossipTxs (force bool ) (int , error ) {
326- if (! force && time .Since (n .lastGossiped ) < txsGossipInterval ) || len (n .txsToGossip ) == 0 {
330+ if (! force && time .Since (n .lastGossiped ) < minGossipBatchInterval ) || len (n .txsToGossip ) == 0 {
327331 return 0 , nil
328332 }
329333 n .lastGossiped = time .Now ()
You can’t perform that action at this time.
0 commit comments