Skip to content

Commit

Permalink
txpool: addRemoteTxs broadcast - missed some txs (#13543)
Browse files Browse the repository at this point in the history
The txpool does not broadcast remote transactions or send them to their
peers. Steps to reproduce the bug:

1) The devnet contains 3 nodes: node1 is connected to node2 via P2P, and
node2 is connected to node3 via P2P.
2) Send a transaction to node3, 
3) It is added to node3 as a local transaction and broadcasted to node2.
4) Node2 receives it as a remote transaction, adds it to its pool, but
never broadcasts it to its peers.

Is this the expected behavior, or is it a bug?

If it is a bug, it seems we may have forgotten to promote transactions
added to the pool (similar to how local transactions are handled in the
AddLocalTxns function).
  • Loading branch information
eastorski authored Jan 24, 2025
1 parent 7f41a5f commit 989e5d5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion txnprovider/txpool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,14 +508,25 @@ func (p *TxPool) processRemoteTxns(ctx context.Context) (err error) {
return err
}

announcements, _, err := p.addTxns(p.lastSeenBlock.Load(), cacheView, p.senders, newTxns,
announcements, reasons, err := p.addTxns(p.lastSeenBlock.Load(), cacheView, p.senders, newTxns,
p.pendingBaseFee.Load(), p.pendingBlobFee.Load(), p.blockGasLimit.Load(), true, p.logger)
if err != nil {
return err
}
p.promoted.Reset()
p.promoted.AppendOther(announcements)

reasons = fillDiscardReasons(reasons, newTxns, p.discardReasonsLRU)
for i, reason := range reasons {
if reason == txpoolcfg.Success {
txn := newTxns.Txns[i]
if txn.Traced {
p.logger.Info(fmt.Sprintf("TX TRACING: processRemoteTxns promotes idHash=%x, senderId=%d", txn.IDHash, txn.SenderID))
}
p.promoted.Append(txn.Type, txn.Size, txn.IDHash[:])
}
}

if p.promoted.Len() > 0 {
select {
case <-ctx.Done():
Expand Down

0 comments on commit 989e5d5

Please sign in to comment.