From 22793ddaad15accc574f32ef15213d68819b7a8a Mon Sep 17 00:00:00 2001 From: YACOVM Date: Sat, 4 Mar 2017 23:51:25 +0200 Subject: [PATCH] [FAB-2007] Gossip: associate self-identity at startup The gossip uses an identity-mapper object which stores mapping between PKI-IDs of peers to their certificates. The method getOrgOfPeer(PKIID common.PKIidType) api.OrgIdentityType (and others) use the id-mapper to obtain the organization ID of a peer. In future commits it is needed to obtain the organization ID of a message that some peer sent. Sometimes it is a message sent by the peer itself, either because it was gossiped to it in the past, or it hasn't been sent yet. Therefore, instead of comparing each time if the PKI-ID is the peer's PKI-ID, it is easiest to simply add the PKI-ID and identity itself into the identity mapper at its creation. Change-Id: I83b92232bd5d96e6874d6c3d82321fd103e7f238 Signed-off-by: Yacov Manevich --- gossip/service/gossip_service.go | 1 + 1 file changed, 1 insertion(+) diff --git a/gossip/service/gossip_service.go b/gossip/service/gossip_service.go index 8bcba1ec384..ce5ef2dc77e 100644 --- a/gossip/service/gossip_service.go +++ b/gossip/service/gossip_service.go @@ -133,6 +133,7 @@ func InitGossipServiceCustomDeliveryFactory(peerIdentity []byte, endpoint string } idMapper := identity.NewIdentityMapper(mcs) + idMapper.Put(mcs.GetPKIidOfCert(peerIdentity), peerIdentity) gossip := integration.NewGossipComponent(peerIdentity, endpoint, s, secAdv, mcs, idMapper, dialOpts, bootPeers...) gossipServiceInstance = &gossipServiceImpl{