Browse Source

mempool: fix TestReactorNoBroadcastToSender (#5984)

## Description

Looks like I missed a test in the original PR when fixing the tests.

Closes: #5956
pull/5989/head
Aleksandr Bezobchuk 4 years ago
committed by GitHub
parent
commit
b19acfb605
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions
  1. +5
    -0
      mempool/reactor.go
  2. +6
    -5
      mempool/reactor_test.go

+ 5
- 0
mempool/reactor.go View File

@ -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:


+ 6
- 5
mempool/reactor_test.go View File

@ -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)()
}

Loading…
Cancel
Save