Skip to content

Commit 376021a

Browse files
author
Srinivasan Muralidharan
committed
FAB-1800 peer should not load channel with bad config
https://jira.hyperledger.org/browse/FAB-1800 peer should stop loading the channel but continue to load the next chain. Also added a panic to the system chaincode if there's no ledger registered with the chain. Change-Id: Ia581c70c636c3be21fbb05e9cd01fafe36c91b09 Signed-off-by: Srinivasan Muralidharan <[email protected]>
1 parent f14cd84 commit 376021a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

core/chaincode/sysccapi.go

+3
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ func deploySysCC(chainID string, syscc *SystemChaincode) error {
9999
ctxt := context.Background()
100100
if !syscc.ChainlessCC {
101101
lgr := peer.GetLedger(chainID)
102+
if lgr == nil {
103+
panic(fmt.Sprintf("syschain %s start up failure - unexpected nil ledger for channel %s", syscc.Name, chainID))
104+
}
102105
var txsim ledger.TxSimulator
103106
if txsim, err = lgr.NewTxSimulator(); err != nil {
104107
return err

core/peer/peer.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@ func Initialize(dsProvider func(string) error) {
9292
}
9393
// Create a chain if we get a valid ledger with config block
9494
if err = createChain(cid, ledger, cb); err != nil {
95-
peerLogger.Warning("Failed to load chain %s", cid)
95+
peerLogger.Warningf("Failed to load chain %s(%s)", cid, err)
9696
peerLogger.Debug("Error reloading chain %s with message %s. We continue to the next chain rather than abort.", cid, err)
97+
continue
9798
}
9899

99100
// now create the delivery service for this chain

0 commit comments

Comments
 (0)