p2p: update shim to transfer information about peers (#8047)

This commit is contained in:
Sam Kleinman
2022-03-02 08:43:47 -05:00
committed by GitHub
parent ca69da7533
commit cc88a31a60
2 changed files with 2 additions and 2 deletions

View File

@@ -233,9 +233,8 @@ func (rs *ReactorShim) GetChannels() []*ChannelDescriptor {
// handle adding a peer.
func (rs *ReactorShim) AddPeer(peer Peer) {
select {
case rs.PeerUpdates.reactorUpdatesCh <- PeerUpdate{NodeID: peer.ID(), Status: PeerStatusUp}:
case rs.PeerUpdates.reactorUpdatesCh <- PeerUpdate{NodeID: peer.ID(), Status: PeerStatusUp, Channels: toChannelIDs(peer.NodeInfo().Channels)}:
rs.Logger.Debug("sent peer update", "reactor", rs.Name, "peer", peer.ID(), "status", PeerStatusUp)
case <-rs.PeerUpdates.Done():
// NOTE: We explicitly DO NOT close the PeerUpdatesCh's updateCh go channel.
// This is because there may be numerous spawned goroutines that are

View File

@@ -84,6 +84,7 @@ func simplePeer(t *testing.T, id string) (*p2pmocks.Peer, types.NodeID) {
peerID := types.NodeID(id)
peer := &p2pmocks.Peer{}
peer.On("ID").Return(peerID)
peer.On("NodeInfo").Return(types.NodeInfo{NodeID: peerID}).Maybe()
return peer, peerID
}