Skip to content

Commit

Permalink
[FAB-6267] fix lscc chaincodename missing when upgrade
Browse files Browse the repository at this point in the history
If the chaincode name is mistaken or deleted when trying to
upgrade, the error message contains chainName instead of chaincode name.
This changeSet fixes that.

Change-Id: I88aef32c8edb2a5932fd71e4ff4c7de3178806e9
Signed-off-by: Hangyu Li <li.hangyu@jp.fujitsu.com>
  • Loading branch information
lihangyu committed Oct 17, 2017
1 parent 9227a52 commit c078fe2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/scc/lscc/lscc.go
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ func (lscc *LifeCycleSysCC) executeUpgrade(stub shim.ChaincodeStubInterface, cha
// have deleted it
cdbytes, _ := lscc.getCCInstance(stub, chaincodeName)
if cdbytes == nil {
return nil, NotFoundErr(chainName)
return nil, NotFoundErr(chaincodeName)
}

//we need the cd to compare the version
Expand Down
2 changes: 1 addition & 1 deletion core/scc/lscc/lscc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ func TestUpgrade(t *testing.T) {
testUpgrade(t, "example02", "0", "example02", "1", path, "")
testUpgrade(t, "example02", "0", "example02", "", path, EmptyVersionErr("example02").Error())
testUpgrade(t, "example02", "0", "example02", "0", path, IdenticalVersionErr("example02").Error())
testUpgrade(t, "example02", "0", "example03", "1", path, NotFoundErr("test").Error())
testUpgrade(t, "example02", "0", "example03", "1", path, NotFoundErr("example03").Error())
testUpgrade(t, "example02", "0", "example02", "1{}0", path, InvalidVersionErr("1{}0").Error())
testUpgrade(t, "example02", "0", "example*02", "1{}0", path, InvalidChaincodeNameErr("example*02").Error())
testUpgrade(t, "example02", "0", "", "1", path, EmptyChaincodeNameErr("").Error())
Expand Down

0 comments on commit c078fe2

Please sign in to comment.