Skip to content

Commit 22793dd

Browse files
committed
[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 <[email protected]>
1 parent 458f435 commit 22793dd

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

gossip/service/gossip_service.go

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ func InitGossipServiceCustomDeliveryFactory(peerIdentity []byte, endpoint string
133133
}
134134

135135
idMapper := identity.NewIdentityMapper(mcs)
136+
idMapper.Put(mcs.GetPKIidOfCert(peerIdentity), peerIdentity)
136137

137138
gossip := integration.NewGossipComponent(peerIdentity, endpoint, s, secAdv, mcs, idMapper, dialOpts, bootPeers...)
138139
gossipServiceInstance = &gossipServiceImpl{

0 commit comments

Comments
 (0)