Skip to content

Commit ca5b143

Browse files
committed
[FAB-11838] Add INFO logging for anchor peers
This change set adds an INFO level logging message that contains the endpoints of the anchor peers (and the corresponding org name) whenever gossip channel reconfiguration takes place. Change-Id: I9c2198917f0a230e8d50ca1d6d93c7824b71350b Signed-off-by: yacovm <yacovm@il.ibm.com>
1 parent 15243b5 commit ca5b143

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

gossip/gossip/gossip_impl.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,9 @@ func (g *gossipServiceImpl) JoinChan(joinMsg api.JoinChannelMessage, chainID com
181181
// joinMsg is supposed to have been already verified
182182
g.chanState.joinChannel(joinMsg, chainID)
183183

184+
g.logger.Info("Joining gossip network of channel", string(chainID), "with", len(joinMsg.Members()), "organizations")
184185
for _, org := range joinMsg.Members() {
185-
g.learnAnchorPeers(org, joinMsg.AnchorPeersOf(org))
186+
g.learnAnchorPeers(string(chainID), org, joinMsg.AnchorPeersOf(org))
186187
}
187188
}
188189

@@ -213,7 +214,12 @@ func (g *gossipServiceImpl) periodicalIdentityValidation(suspectFunc api.PeerSus
213214
}
214215
}
215216

216-
func (g *gossipServiceImpl) learnAnchorPeers(orgOfAnchorPeers api.OrgIdentityType, anchorPeers []api.AnchorPeer) {
217+
func (g *gossipServiceImpl) learnAnchorPeers(channel string, orgOfAnchorPeers api.OrgIdentityType, anchorPeers []api.AnchorPeer) {
218+
if len(anchorPeers) == 0 {
219+
g.logger.Info("No configured anchor peers of", string(orgOfAnchorPeers), "for channel", channel, "to learn about")
220+
return
221+
}
222+
g.logger.Info("Learning about the configured anchor peers of", string(orgOfAnchorPeers), "for channel", channel, ":", anchorPeers)
217223
for _, ap := range anchorPeers {
218224
if ap.Host == "" {
219225
g.logger.Warning("Got empty hostname, skipping connecting to anchor peer", ap)

0 commit comments

Comments
 (0)