Skip to content

Commit

Permalink
FAB-1800 peer should not load channel with bad config
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Srinivasan Muralidharan committed Jan 22, 2017
1 parent f14cd84 commit 376021a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions core/chaincode/sysccapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ func deploySysCC(chainID string, syscc *SystemChaincode) error {
ctxt := context.Background()
if !syscc.ChainlessCC {
lgr := peer.GetLedger(chainID)
if lgr == nil {
panic(fmt.Sprintf("syschain %s start up failure - unexpected nil ledger for channel %s", syscc.Name, chainID))
}
var txsim ledger.TxSimulator
if txsim, err = lgr.NewTxSimulator(); err != nil {
return err
Expand Down
3 changes: 2 additions & 1 deletion core/peer/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ func Initialize(dsProvider func(string) error) {
}
// Create a chain if we get a valid ledger with config block
if err = createChain(cid, ledger, cb); err != nil {
peerLogger.Warning("Failed to load chain %s", cid)
peerLogger.Warningf("Failed to load chain %s(%s)", cid, err)
peerLogger.Debug("Error reloading chain %s with message %s. We continue to the next chain rather than abort.", cid, err)
continue
}

// now create the delivery service for this chain
Expand Down

0 comments on commit 376021a

Please sign in to comment.