Commit 97f5f2fa authored by Alessandro Sorniotti's avatar Alessandro Sorniotti Committed by Gerrit Code Review

Merge "FAB-13990 Disable old lifecycle on capability"

parents 45c7122f 5d93d2f5
......@@ -884,6 +884,10 @@ func (lscc *LifeCycleSysCC) Invoke(stub shim.ChaincodeStubInterface) pb.Response
logger.Panicf("programming error, non-existent appplication config for channel '%s'", channel)
}
if ac.Capabilities().LifecycleV20() {
return shim.Error(fmt.Sprintf("Channel '%s' has been migrated to the new lifecycle, LSCC is now read-only", channel))
}
// the maximum number of arguments depends on the capability of the channel
if !ac.Capabilities().PrivateChannelData() && len(args) > 6 {
return shim.Error(PrivateChannelDataNotAvailable("").Error())
......
......@@ -176,6 +176,25 @@ func testInstall(t *testing.T, ccname string, version string, path string, creat
}
}
func TestNewLifecycleEnabled(t *testing.T) {
// Enable PrivateChannelData
mocksccProvider := (&mscc.MocksccProviderFactory{
ApplicationConfigBool: true,
ApplicationConfigRv: &config.MockApplication{
CapabilitiesRv: &config.MockApplicationCapabilities{
LifecycleV20Rv: true,
},
},
}).NewSystemChaincodeProvider().(*mscc.MocksccProviderImpl)
scc := New(mocksccProvider, mockAclProvider, platforms.NewRegistry(&golang.Platform{}))
stub := shim.NewMockStub("lscc", scc)
res := stub.MockInvokeWithSignedProposal("1", [][]byte{[]byte("deploy"), []byte("test"), nil}, nil)
assert.NotEqual(t, int32(shim.OK), res.Status)
assert.Equal(t, "Channel 'test' has been migrated to the new lifecycle, LSCC is now read-only", res.Message)
}
func TestDeploy(t *testing.T) {
path := "mychaincode"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment