Skip to content

Commit

Permalink
Merge branch 'fix-mempool-spam' into test/abci-routing
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek committed Feb 14, 2024
2 parents 1562299 + 7f254b9 commit f664225
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 2 additions & 3 deletions internal/mempool/reactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ func (r *Reactor) broadcastTxRoutine(ctx context.Context, peerID types.NodeID) {

memTx := nextGossipTx.Value.(*WrappedTx)

// We expect the peer to send tx back once it gets it, and that's
// when we will mark it as seen.
// NOTE: Transaction batching was disabled due to:
// https://github.com/tendermint/tendermint/issues/5796
if !memTx.HasPeer(peerMempoolID) {
Expand All @@ -205,9 +207,6 @@ func (r *Reactor) broadcastTxRoutine(ctx context.Context, peerID types.NodeID) {
r.logger.Error("failed to gossip transaction", "peerID", peerID, "error", err)
return
}
// This is optimistic approach, we assume that the transaction was successfully
// gossiped to the peer.
memTx.SetPeer(peerMempoolID)

r.logger.Debug("gossiped tx to peer",
"tx", tmstrings.LazySprintf("%X", memTx.tx.Hash()),
Expand Down
6 changes: 3 additions & 3 deletions internal/p2p/channel_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ func ChannelDescriptors(cfg *config.Config) map[ChannelID]*ChannelDescriptor {
RecvMessageCapacity: mempoolBatchSize(cfg.Mempool.MaxTxBytes),
RecvBufferCapacity: 1000,
Name: "mempool",
// SendRateLimit: 5,
// SendRateBurst: 20,
EnqueueTimeout: 10 * time.Millisecond,
SendRateLimit: 5,
SendRateBurst: 20,
EnqueueTimeout: 10 * time.Millisecond,
},
}

Expand Down
2 changes: 2 additions & 0 deletions internal/p2p/conn/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,8 @@ type ChannelDescriptor struct {
Name string

// Timeout for enqueue operations on the incoming queue.
// It is applied to all messages received from remote peer
// and delievered to this channel.
// When timeout expires, messages will be silently dropped.
//
// If zero, enqueue operations will not time out.
Expand Down

0 comments on commit f664225

Please sign in to comment.