Skip to content

Commit

Permalink
[FAB-7399] Check for nil resources config
Browse files Browse the repository at this point in the history
If the experimental resources tree support is enabled, but the genesis
block does not contain a seed resources tree, then an error is thrown
because the config is nil.  This CR simply checks for the nil case, and
if so, uses an empty resources tree as the seed.

Change-Id: I7c031d5c450cf9601175fc04a7d2c5355f051b7a
Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
  • Loading branch information
Jason Yellick committed Jan 5, 2018
1 parent 5db5b21 commit e997f7d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/peer/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,17 @@ func createChain(cid string, ledger ledger.PeerLedger, cb *common.Block) error {

resConf := &common.Config{ChannelGroup: &common.ConfigGroup{}}
if ac != nil && ac.Capabilities().ResourcesTree() {
if resConf, err = retrievePersistedResourceConfig(ledger); err != nil {
iResConf, err := retrievePersistedResourceConfig(ledger)

if err != nil {
return err
}

if iResConf != nil {
resConf = iResConf
}
}

rBundle, err := resourcesconfig.NewBundle(cid, resConf, bundle)

cs.bundleSource = resourcesconfig.NewBundleSource(
Expand Down

0 comments on commit e997f7d

Please sign in to comment.