mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-20 22:26:15 +00:00
mempool: fix TestReactorNoBroadcastToSender (#5984)
## Description Looks like I missed a test in the original PR when fixing the tests. Closes: #5956
This commit is contained in:
@@ -224,11 +224,16 @@ func (r *Reactor) processMempoolCh() {
|
||||
case envelope := <-r.mempoolCh.In():
|
||||
if err := r.handleMessage(r.mempoolCh.ID(), envelope); err != nil {
|
||||
r.Logger.Error("failed to process message", "ch_id", r.mempoolCh.ID(), "envelope", envelope, "err", err)
|
||||
|
||||
fmt.Println("MESSAGE HANDLER ERROR:", err)
|
||||
|
||||
r.mempoolCh.Error() <- p2p.PeerError{
|
||||
PeerID: envelope.From,
|
||||
Err: err,
|
||||
Severity: p2p.PeerErrorSeverityLow,
|
||||
}
|
||||
|
||||
fmt.Println("SENT PEER ERROR ON CHANNEL")
|
||||
}
|
||||
|
||||
case <-r.closeCh:
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/fortytw2/leaktest"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/tendermint/tendermint/abci/example/kvstore"
|
||||
@@ -287,6 +286,12 @@ func TestReactorNoBroadcastToSender(t *testing.T) {
|
||||
primary := testSuites[0]
|
||||
secondary := testSuites[1]
|
||||
|
||||
go func() {
|
||||
// drop all errors on the mempool channel
|
||||
for range primary.mempoolPeerErrCh {
|
||||
}
|
||||
}()
|
||||
|
||||
peerID := uint16(1)
|
||||
_ = checkTxs(t, primary.reactor.mempool, numTxs, peerID)
|
||||
|
||||
@@ -454,8 +459,4 @@ func TestBroadcastTxForPeerStopsWhenPeerStops(t *testing.T) {
|
||||
Status: p2p.PeerStatusDown,
|
||||
PeerID: secondary.peerID,
|
||||
}
|
||||
|
||||
// check that we are not leaking any go-routines
|
||||
// i.e. broadcastTxRoutine finishes when peer is stopped
|
||||
leaktest.CheckTimeout(t, 10*time.Second)()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user