Make flushing of GossipSender wait till done in tests,
and take extra locks to avoid race conditions. Also removed the sendPendingGossip() from mockChannelConnection.SendProtocolMsg(), because waiting in flush now creates a deadlock. Tests will have to call sendPendingGossip() explicitly if they need it.
This commit is contained in:
1 parent
94f18f7004
commit
569fd784fa
2 files changed
+28
-12
No files matched your search
@@ -30,7 +30,6 @@ func (conn *mockChannelConnection) SendProtocolMsg(protocolMsg ProtocolMsg) {
|
||||
if err := conn.dest.handleGossip(protocolMsg.tag, protocolMsg.msg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
conn.dest.sendPendingGossip()
|
||||
}
|
||||
|
||||
func (router *Router) AddTestChannelConnection(r *Router) {
|
||||
@@ -87,7 +86,9 @@ func (router *Router) tp(routers ...*Router) *Peer {
|
||||
|
||||
// Check that the topology of router matches the peers and all of their connections
|
||||
func checkTopology(t *testing.T, router *Router, wantedPeers ...*Peer) {
|
||||
router.Peers.RLock()
|
||||
checkTopologyPeers(t, true, router.Peers.allPeers(), wantedPeers...)
|
||||
router.Peers.RUnlock()
|
||||
}
|
||||
|
||||
func implTestGossipTopology(t *testing.T) {
|
||||
|
||||
Reference in new issue
Block a user