Skip to content

Commit 45adaa6

Browse files
committed
[FAB-9328] Fail at the beginning if no MSP ID
If there's no MSP ID, we should fail at the beginning of InitCrypto before we do more configration and initialization work. Change-Id: I9381526a5339267da5f4b7f2455303df4e0eeb69 Signed-off-by: Zhenguo Niu <Niu.ZGlinux@gmail.com>
1 parent f22cc02 commit 45adaa6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

peer/common/common.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,16 @@ func InitConfig(cmdRoot string) error {
8686
//InitCrypto initializes crypto for this peer
8787
func InitCrypto(mspMgrConfigDir, localMSPID, localMSPType string) error {
8888
var err error
89-
// Check whenever msp folder exists
89+
// Check whether msp folder exists
9090
_, err = os.Stat(mspMgrConfigDir)
9191
if os.IsNotExist(err) {
9292
// No need to try to load MSP from folder which is not available
9393
return errors.Errorf("cannot init crypto, missing %s folder", mspMgrConfigDir)
9494
}
95+
// Check whether localMSPID exists
96+
if localMSPID == "" {
97+
return errors.New("the local MSP must have an ID")
98+
}
9599

96100
// Init the BCCSP
97101
SetBCCSPKeystorePath()

0 commit comments

Comments
 (0)