@@ -29,7 +29,7 @@ const (
29
29
30
30
// peerHeightDiff signifies the tolerance in difference in height between the peer and the height
31
31
// the node received the tx
32
- peerHeightDiff = 10
32
+ peerHeightDiff = 2
33
33
)
34
34
35
35
// Reactor handles mempool tx broadcasting logic amongst peers. For the main
@@ -303,7 +303,7 @@ func (memR *Reactor) ReceiveEnvelope(e p2p.Envelope) {
303
303
peerID := memR .ids .GetIDForPeer (e .Src .ID ())
304
304
memR .mempool .PeerHasTx (peerID , txKey )
305
305
// Check if we don't already have the transaction and that it was recently rejected
306
- if memR .mempool .Has (txKey ) || memR .mempool .IsRejectedTx (txKey ) {
306
+ if memR .mempool .Has (txKey ) || memR .mempool .IsRejectedTx (txKey ) || memR . mempool . store . hasCommitted ( txKey ) {
307
307
memR .Logger .Debug ("received a seen tx for a tx we already have" , "txKey" , txKey )
308
308
return
309
309
}
@@ -341,7 +341,7 @@ func (memR *Reactor) ReceiveEnvelope(e p2p.Envelope) {
341
341
}
342
342
if has && ! memR .opts .ListenOnly {
343
343
peerID := memR .ids .GetIDForPeer (e .Src .ID ())
344
- memR .Logger .Debug ("sending a tx in response to a want msg" , "peer" , peerID )
344
+ memR .Logger .Info ("sending a tx in response to a want msg" , "peer" , peerID )
345
345
if p2p .SendEnvelopeShim (e .Src , p2p.Envelope { //nolint:staticcheck
346
346
ChannelID : mempool .MempoolChannel ,
347
347
Message : & protomem.Txs {Txs : [][]byte {tx }},
@@ -404,7 +404,9 @@ func (memR *Reactor) broadcastSeenTx(txKey types.TxKey) {
404
404
continue
405
405
}
406
406
407
- peer .Send (MempoolStateChannel , bz ) //nolint:staticcheck
407
+ if peer .Send (MempoolStateChannel , bz ) {
408
+ memR .Logger .Info ("sent seen tx to peer" , "peerID" , peer .ID (), "txKey" , txKey )
409
+ }
408
410
}
409
411
}
410
412
@@ -450,7 +452,6 @@ func (memR *Reactor) requestTx(txKey types.TxKey, peer p2p.Peer) {
450
452
// we have disconnected from the peer
451
453
return
452
454
}
453
- memR .Logger .Debug ("requesting tx" , "txKey" , txKey , "peerID" , peer .ID ())
454
455
msg := & protomem.Message {
455
456
Sum : & protomem.Message_WantTx {
456
457
WantTx : & protomem.WantTx {TxKey : txKey [:]},
@@ -463,10 +464,11 @@ func (memR *Reactor) requestTx(txKey types.TxKey, peer p2p.Peer) {
463
464
464
465
success := peer .Send (MempoolStateChannel , bz ) //nolint:staticcheck
465
466
if success {
467
+ memR .Logger .Info ("requested tx" , "txKey" , txKey , "peerID" , peer .ID ())
466
468
memR .mempool .metrics .RequestedTxs .Add (1 )
467
469
requested := memR .requests .Add (txKey , memR .ids .GetIDForPeer (peer .ID ()), memR .findNewPeerToRequestTx )
468
470
if ! requested {
469
- memR .Logger .Debug ("have already marked a tx as requested" , "txKey" , txKey , "peerID" , peer .ID ())
471
+ memR .Logger .Error ("have already marked a tx as requested" , "txKey" , txKey , "peerID" , peer .ID ())
470
472
}
471
473
}
472
474
}
0 commit comments