Skip to content

Commit

Permalink
Merge "[FAB-3702] remove unused code in ./core/chaincode"
Browse files Browse the repository at this point in the history
  • Loading branch information
christo4ferris authored and Gerrit Code Review committed May 9, 2017
2 parents e76aa71 + 92d4cf2 commit a54d5bf
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 80 deletions.
1 change: 0 additions & 1 deletion core/chaincode/chaincode_support.go
Expand Up @@ -49,7 +49,6 @@ const (
// DevModeUserRunsChaincode property allows user to run chaincode in development environment
DevModeUserRunsChaincode string = "dev"
chaincodeStartupTimeoutDefault int = 5000
chaincodeInstallPathDefault string = "/opt/gopath/bin/"
peerAddressDefault string = "0.0.0.0:7051"

//TXSimulatorKey is used to attach ledger simulation context
Expand Down
25 changes: 1 addition & 24 deletions core/chaincode/exectransaction.go
Expand Up @@ -17,16 +17,13 @@ limitations under the License.
package chaincode

import (
"errors"
"fmt"

"github.com/golang/protobuf/proto"
"golang.org/x/net/context"

"github.com/hyperledger/fabric/core/chaincode/shim"
"github.com/hyperledger/fabric/core/common/ccprovider"
"github.com/hyperledger/fabric/events/producer"
pb "github.com/hyperledger/fabric/protos/peer"
"golang.org/x/net/context"
)

//Execute - execute proposal, return original response of chaincode
Expand Down Expand Up @@ -118,23 +115,3 @@ func ExecuteWithErrorFilter(ctxt context.Context, cccid *ccprovider.CCContext, s

return res.Payload, event, nil
}

// GetSecureContext returns the security context from the context object or error
// Security context is nil if security is off from core.yaml file
// func GetSecureContext(ctxt context.Context) (crypto.Peer, error) {
// var err error
// temp := ctxt.Value("security")
// if nil != temp {
// if secCxt, ok := temp.(crypto.Peer); ok {
// return secCxt, nil
// }
// err = errors.New("Failed to convert security context type")
// }
// return nil, err
// }

var errFailedToGetChainCodeSpecForTransaction = errors.New("Failed to get ChainCodeSpec from Transaction")

func sendTxRejectedEvent(tx *pb.Transaction, errorMsg string) {
producer.Send(producer.CreateRejectionEvent(tx, errorMsg))
}
2 changes: 0 additions & 2 deletions core/chaincode/exectransaction_test.go
Expand Up @@ -643,11 +643,9 @@ func invokeExample02Transaction(ctxt context.Context, cccid *ccprovider.CCContex
const (
chaincodeExample02GolangPath = "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02"
chaincodeExample04GolangPath = "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example04"
chaincodeExample05GolangPath = "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example05"
chaincodeEventSenderGolangPath = "github.com/hyperledger/fabric/examples/chaincode/go/eventsender"
chaincodeExample02JavaPath = "../../examples/chaincode/java/chaincode_example02"
chaincodeExample04JavaPath = "../../examples/chaincode/java/chaincode_example04"
chaincodeExample05JavaPath = "../../examples/chaincode/java/chaincode_example05"
chaincodeExample06JavaPath = "../../examples/chaincode/java/chaincode_example06"
chaincodeEventSenderJavaPath = "../../examples/chaincode/java/eventsender"
)
Expand Down
53 changes: 0 additions & 53 deletions core/chaincode/handler.go
Expand Up @@ -261,23 +261,6 @@ func (handler *Handler) checkACL(signedProp *pb.SignedProposal, proposal *pb.Pro
return handler.policyChecker.CheckPolicy(ccIns.ChainID, policies.ChannelApplicationWriters, signedProp)
}

//THIS CAN BE REMOVED ONCE WE FULL SUPPORT (Invoke) CONFIDENTIALITY WITH CC-CALLING-CC
//Only invocation are allowed
func (handler *Handler) canCallChaincode(txid string, isQuery bool) *pb.ChaincodeMessage {
var errMsg string
txctx := handler.getTxContext(txid)
if txctx == nil {
errMsg = fmt.Sprintf("[%s]Error no context while checking for confidentiality. Sending %s", shorttxid(txid), pb.ChaincodeMessage_ERROR)
}

if errMsg != "" {
return &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_ERROR, Payload: []byte(errMsg), Txid: txid}
}

//not CONFIDENTIAL transaction, OK to call CC
return nil
}

func (handler *Handler) deregister() error {
if handler.registered {
handler.chaincodeSupport.deregisterHandler(handler)
Expand Down Expand Up @@ -1151,42 +1134,6 @@ func (handler *Handler) handleGetHistoryForKey(msg *pb.ChaincodeMessage) {
}()
}

// afterPutState handles a PUT_STATE request from the chaincode.
func (handler *Handler) afterPutState(e *fsm.Event, state string) {
_, ok := e.Args[0].(*pb.ChaincodeMessage)
if !ok {
e.Cancel(fmt.Errorf("Received unexpected message type"))
return
}
chaincodeLogger.Debugf("Received %s in state %s, invoking put state to ledger", pb.ChaincodeMessage_PUT_STATE, state)

// Put state into ledger handled within enterBusyState
}

// afterDelState handles a DEL_STATE request from the chaincode.
func (handler *Handler) afterDelState(e *fsm.Event, state string) {
_, ok := e.Args[0].(*pb.ChaincodeMessage)
if !ok {
e.Cancel(fmt.Errorf("Received unexpected message type"))
return
}
chaincodeLogger.Debugf("Received %s, invoking delete state from ledger", pb.ChaincodeMessage_DEL_STATE)

// Delete state from ledger handled within enterBusyState
}

// afterInvokeChaincode handles an INVOKE_CHAINCODE request from the chaincode.
func (handler *Handler) afterInvokeChaincode(e *fsm.Event, state string) {
_, ok := e.Args[0].(*pb.ChaincodeMessage)
if !ok {
e.Cancel(fmt.Errorf("Received unexpected message type"))
return
}
chaincodeLogger.Debugf("Received %s in state %s, invoking another chaincode", pb.ChaincodeMessage_INVOKE_CHAINCODE, state)

// Invoke another chaincode handled within enterBusyState
}

// Handles request to ledger to put state
func (handler *Handler) enterBusyState(e *fsm.Event, state string) {
go func() {
Expand Down

0 comments on commit a54d5bf

Please sign in to comment.