Browse Source

mempool/reactor: fix reactor broadcast test (#5362)

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:

b8d08b9ef4/mempool/reactor.go (L216-L226)

this PR fixes the issue by init peer state key.
pull/5386/head
ninjaahhh 4 years ago
committed by GitHub
parent
commit
0e311abf19
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      mempool/reactor_test.go

+ 5
- 0
mempool/reactor_test.go View File

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


Loading…
Cancel
Save