Browse Source

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

pull/8024/head
Sam Kleinman 2 years ago
committed by GitHub
parent
commit
cc88a31a60
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions
  1. +1
    -2
      internal/p2p/shim.go
  2. +1
    -0
      internal/p2p/shim_test.go

+ 1
- 2
internal/p2p/shim.go 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


+ 1
- 0
internal/p2p/shim_test.go 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
}


Loading…
Cancel
Save