|
|
@ -294,11 +294,25 @@ func (n *Node) MakeChannelNoCleanup( |
|
|
|
// MakePeerUpdates opens a peer update subscription, with automatic cleanup.
|
|
|
|
// It checks that all updates have been consumed during cleanup.
|
|
|
|
func (n *Node) MakePeerUpdates(t *testing.T) *p2p.PeerUpdates { |
|
|
|
t.Helper() |
|
|
|
sub := n.PeerManager.Subscribe() |
|
|
|
t.Cleanup(func() { |
|
|
|
t.Helper() |
|
|
|
RequireNoUpdates(t, sub) |
|
|
|
sub.Close() |
|
|
|
}) |
|
|
|
|
|
|
|
return sub |
|
|
|
} |
|
|
|
|
|
|
|
// MakePeerUpdatesNoRequireEmpty opens a peer update subscription, with automatic cleanup.
|
|
|
|
// It does *not* check that all updates have been consumed, but will
|
|
|
|
// close the update channel.
|
|
|
|
func (n *Node) MakePeerUpdatesNoRequireEmpty(t *testing.T) *p2p.PeerUpdates { |
|
|
|
sub := n.PeerManager.Subscribe() |
|
|
|
t.Cleanup(func() { |
|
|
|
sub.Close() |
|
|
|
}) |
|
|
|
|
|
|
|
return sub |
|
|
|
} |