Skip to content

Commit

Permalink
mempool/reactor: fix reactor broadcast test (#5362)
Browse files Browse the repository at this point in the history
found out this issue when trying to decouple mempool reactor with its
underlying clist implementation.

according to its comment, the test `TestReactorNoBroadcastToSender` is
intended to make sure that a peer shouldn't send tx back to its origin.
however, the current test forgot to init peer state key, thus the code
will get stuck at waiting for peer to catch up state *instead of* skipping
sending tx back:

https://github.com/tendermint/tendermint/blob/b8d08b9ef448365695de19fea0156e1c8611ae7b/mempool/reactor.go#L216-L226

this PR fixes the issue by init peer state key.
  • Loading branch information
ninjaahhh authored Sep 22, 2020
1 parent ed002ce commit 0e311ab
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mempool/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ func TestReactorNoBroadcastToSender(t *testing.T) {
}
}
}()
for _, r := range reactors {
for _, peer := range r.Switch.Peers().List() {
peer.Set(types.PeerStateKey, peerState{1})
}
}

const peerID = 1
checkTxs(t, reactors[0].mempool, numTxs, peerID)
Expand Down

0 comments on commit 0e311ab

Please sign in to comment.