diff --git a/core/scc/lscc/lscc.go b/core/scc/lscc/lscc.go index 12a8950b293..469c4eeedc0 100644 --- a/core/scc/lscc/lscc.go +++ b/core/scc/lscc/lscc.go @@ -400,6 +400,10 @@ func (lscc *lifeCycleSysCC) executeInstall(stub shim.ChaincodeStubInterface, ccb return err } + if lscc.sccprovider.IsSysCC(cds.ChaincodeSpec.ChaincodeId.Name) { + return errors.Errorf("cannot install: %s is the name of a system chaincode", cds.ChaincodeSpec.ChaincodeId.Name) + } + // Get any statedb artifacts from the chaincode package, e.g. couchdb index definitions statedbArtifactsTar, err := ccprovider.ExtractStatedbArtifactsFromCCPackage(ccpack) if err != nil { diff --git a/core/scc/lscc/lscc_test.go b/core/scc/lscc/lscc_test.go index 3e047e3afa2..c96af06b747 100644 --- a/core/scc/lscc/lscc_test.go +++ b/core/scc/lscc/lscc_test.go @@ -128,6 +128,8 @@ func TestInstall(t *testing.T) { scc.support.(*lscc.MockSupport).PutChaincodeToLocalStorageErr = errors.New("barf") testInstall(t, "example02", "0", path, false, "barf", "Alice", scc, stub) + + testInstall(t, "lscc", "0", path, false, "cannot install: lscc is the name of a system chaincode", "Alice", scc, stub) } func testInstall(t *testing.T, ccname string, version string, path string, createInvalidIndex bool, expectedErrorMsg string, caller string, scc *lifeCycleSysCC, stub *shim.MockStub) {