Skip to content

Commit

Permalink
[FAB-2007] Gossip: associate self-identity at startup
Browse files Browse the repository at this point in the history
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 <yacovm@il.ibm.com>
  • Loading branch information
yacovm committed Mar 5, 2017
1 parent 458f435 commit 22793dd
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions gossip/service/gossip_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 22793dd

Please sign in to comment.