Skip to content

Commit

Permalink
Merge "[FAB-17095] MCS not to print identities as bytes"
Browse files Browse the repository at this point in the history
  • Loading branch information
yacovm authored and Gerrit Code Review committed Nov 18, 2019
2 parents b86a86f + 6cd02a6 commit 9d1c247
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/peer/gossip/mcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (s *MSPMessageCryptoService) GetPKIidOfCert(peerIdentity api.PeerIdentityTy

sid, err := s.deserializer.Deserialize(peerIdentity)
if err != nil {
mcsLogger.Errorf("Failed getting validated identity from peer identity [% x]: [%s]", peerIdentity, err)
mcsLogger.Errorf("Failed getting validated identity from peer identity %s: [%s]", peerIdentity, err)

return nil
}
Expand All @@ -111,7 +111,7 @@ func (s *MSPMessageCryptoService) GetPKIidOfCert(peerIdentity api.PeerIdentityTy
// Hash
digest, err := s.hasher.Hash(raw, &bccsp.SHA256Opts{})
if err != nil {
mcsLogger.Errorf("Failed computing digest of serialized identity [% x]: [%s]", peerIdentity, err)
mcsLogger.Errorf("Failed computing digest of serialized identity %s: [%s]", peerIdentity, err)
return nil
}

Expand Down Expand Up @@ -312,7 +312,7 @@ func (s *MSPMessageCryptoService) getValidatedIdentity(peerIdentity api.PeerIden
// Deserialize identity
identity, err := mspManager.DeserializeIdentity([]byte(peerIdentity))
if err != nil {
mcsLogger.Debugf("Failed deserialization identity [% x] on [%s]: [%s]", peerIdentity, chainID, err)
mcsLogger.Debugf("Failed deserialization identity %s on [%s]: [%s]", peerIdentity, chainID, err)
continue
}

Expand All @@ -327,14 +327,14 @@ func (s *MSPMessageCryptoService) getValidatedIdentity(peerIdentity api.PeerIden
// This will be done by the caller function, if needed.

if err := identity.Validate(); err != nil {
mcsLogger.Debugf("Failed validating identity [% x] on [%s]: [%s]", peerIdentity, chainID, err)
mcsLogger.Debugf("Failed validating identity %s on [%s]: [%s]", peerIdentity, chainID, err)
continue
}

mcsLogger.Debugf("Validation succeeded [% x] on [%s]", peerIdentity, chainID)
mcsLogger.Debugf("Validation succeeded %s on [%s]", peerIdentity, chainID)

return identity, common.ChannelID(chainID), nil
}

return nil, nil, fmt.Errorf("Peer Identity [% x] cannot be validated. No MSP found able to do that.", peerIdentity)
return nil, nil, fmt.Errorf("Peer Identity %s cannot be validated. No MSP found able to do that.", peerIdentity)
}

0 comments on commit 9d1c247

Please sign in to comment.