mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-09 14:43:19 +00:00
p2p: update shim to transfer information about peers (#8047)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user