Skip to content
  • YACOVM's avatar
    [FAB-2624] Gossip Anchor peer connect bug fix · 48987d23
    YACOVM authored
    
    
    When the PEM was removed from the anchor peers, the Connect()
    method of the discovery layer wasn't updated accordingly.
    As a result, all anchor peers were mapped to the same (empty string) key
    in the discovery layer
    
    This commit:
    1) Changes the logic and semantics of the Connect():
       It now creates a membership request that doesn't
       (or does, up to the caller) have the internal endpoint inside of it,
       according to the param passed.
       This is because we don't have knowledge of whether the
       remote anchor peer is in our organization or not.
    2) Changes the test case of the gossip:ConnectToAnchorPeers
       to simulate a situation that would've caught the bug
       had it been tested in the first place:
       Starting 10 peers, waiting a bit and then starting a *random*
       anchor peer out of the 3 anchor peers given to the 10 peers.
       With the bug- all peers would've mapped all anchor peers to the same
       key, thus unable to connect with probability of 2/3.
    3) Changes the test of TestConnect in the discovery package
       to test that the when the Connect() is invoked with false,
       meaning- not to send the internal endpoint, the first membershipRequest
       that is sent indeed doesn't contain the internal endpoint.
       and also adds a test for each of the options (true, false) of
       the method createMembershipRequest(includeInternalEndpoint)
    
    Signed-off-by: default avatarYacov Manevich <yacovm@il.ibm.com>
    Change-Id: Ibd167188dac214951adedfc2ef050d635c6db79f
    48987d23