代码拉取完成,页面将自动刷新
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package lifecycle
import (
"fmt"
"github.com/hyperledger/fabric/core/chaincode/shim"
pb "github.com/hyperledger/fabric/protos/peer"
)
// SCC implements the required methods to satisfy the chaincode interface.
// It routes the invocation calls to the backing implementations.
type SCC struct{}
// Name returns "+lifecycle"
func (scc *SCC) Name() string {
return "+lifecycle"
}
// Path returns "github.com/hyperledger/fabric/core/chaincode/lifecycle"
func (scc *SCC) Path() string {
return "github.com/hyperledger/fabric/core/chaincode/lifecycle"
}
// InitArgs returns nil
func (scc *SCC) InitArgs() [][]byte {
return nil
}
// Chaincode returns a reference to itself
func (scc *SCC) Chaincode() shim.Chaincode {
return scc
}
// InvokableExternal returns true
func (scc *SCC) InvokableExternal() bool {
return true
}
// InvokableCC2CC returns true
func (scc *SCC) InvokableCC2CC() bool {
return true
}
// Enabled returns true
func (scc *SCC) Enabled() bool {
return true
}
// Init is mostly useless for system chaincodes and always returns success
func (scc *SCC) Init(stub shim.ChaincodeStubInterface) pb.Response {
return shim.Success(nil)
}
// Invoke takes chaincode invocation arguments and routes them to the correct
// underlying lifecycle operation.
func (scc *SCC) Invoke(stub shim.ChaincodeStubInterface) pb.Response {
args := stub.GetArgs()
if len(args) == 0 {
return shim.Error("lifecycle scc must be invoked with arguments")
}
funcName := args[0]
switch funcName {
// Each lifecycle SCC function gets a case here
default:
return shim.Error(fmt.Sprintf("unknown lifecycle function: %s", funcName))
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。