Skip to content

Commit 92d4cf2

Browse files
author
conghonglei
committed
[FAB-3702] remove unused code in ./core/chaincode
Change-Id: Id13feeede24c2833367bbbc443c8591fce88cab0 Signed-off-by: conghonglei <[email protected]>
1 parent c346b06 commit 92d4cf2

File tree

4 files changed

+1
-80
lines changed

4 files changed

+1
-80
lines changed

core/chaincode/chaincode_support.go

-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ const (
4949
// DevModeUserRunsChaincode property allows user to run chaincode in development environment
5050
DevModeUserRunsChaincode string = "dev"
5151
chaincodeStartupTimeoutDefault int = 5000
52-
chaincodeInstallPathDefault string = "/opt/gopath/bin/"
5352
peerAddressDefault string = "0.0.0.0:7051"
5453

5554
//TXSimulatorKey is used to attach ledger simulation context

core/chaincode/exectransaction.go

+1-24
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,13 @@ limitations under the License.
1717
package chaincode
1818

1919
import (
20-
"errors"
2120
"fmt"
2221

2322
"github.com/golang/protobuf/proto"
24-
"golang.org/x/net/context"
25-
2623
"github.com/hyperledger/fabric/core/chaincode/shim"
2724
"github.com/hyperledger/fabric/core/common/ccprovider"
28-
"github.com/hyperledger/fabric/events/producer"
2925
pb "github.com/hyperledger/fabric/protos/peer"
26+
"golang.org/x/net/context"
3027
)
3128

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

119116
return res.Payload, event, nil
120117
}
121-
122-
// GetSecureContext returns the security context from the context object or error
123-
// Security context is nil if security is off from core.yaml file
124-
// func GetSecureContext(ctxt context.Context) (crypto.Peer, error) {
125-
// var err error
126-
// temp := ctxt.Value("security")
127-
// if nil != temp {
128-
// if secCxt, ok := temp.(crypto.Peer); ok {
129-
// return secCxt, nil
130-
// }
131-
// err = errors.New("Failed to convert security context type")
132-
// }
133-
// return nil, err
134-
// }
135-
136-
var errFailedToGetChainCodeSpecForTransaction = errors.New("Failed to get ChainCodeSpec from Transaction")
137-
138-
func sendTxRejectedEvent(tx *pb.Transaction, errorMsg string) {
139-
producer.Send(producer.CreateRejectionEvent(tx, errorMsg))
140-
}

core/chaincode/exectransaction_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -637,11 +637,9 @@ func invokeExample02Transaction(ctxt context.Context, cccid *ccprovider.CCContex
637637
const (
638638
chaincodeExample02GolangPath = "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02"
639639
chaincodeExample04GolangPath = "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example04"
640-
chaincodeExample05GolangPath = "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example05"
641640
chaincodeEventSenderGolangPath = "github.com/hyperledger/fabric/examples/chaincode/go/eventsender"
642641
chaincodeExample02JavaPath = "../../examples/chaincode/java/chaincode_example02"
643642
chaincodeExample04JavaPath = "../../examples/chaincode/java/chaincode_example04"
644-
chaincodeExample05JavaPath = "../../examples/chaincode/java/chaincode_example05"
645643
chaincodeExample06JavaPath = "../../examples/chaincode/java/chaincode_example06"
646644
chaincodeEventSenderJavaPath = "../../examples/chaincode/java/eventsender"
647645
)

core/chaincode/handler.go

-53
Original file line numberDiff line numberDiff line change
@@ -261,23 +261,6 @@ func (handler *Handler) checkACL(signedProp *pb.SignedProposal, proposal *pb.Pro
261261
return handler.policyChecker.CheckPolicy(ccIns.ChainID, policies.ChannelApplicationWriters, signedProp)
262262
}
263263

264-
//THIS CAN BE REMOVED ONCE WE FULL SUPPORT (Invoke) CONFIDENTIALITY WITH CC-CALLING-CC
265-
//Only invocation are allowed
266-
func (handler *Handler) canCallChaincode(txid string, isQuery bool) *pb.ChaincodeMessage {
267-
var errMsg string
268-
txctx := handler.getTxContext(txid)
269-
if txctx == nil {
270-
errMsg = fmt.Sprintf("[%s]Error no context while checking for confidentiality. Sending %s", shorttxid(txid), pb.ChaincodeMessage_ERROR)
271-
}
272-
273-
if errMsg != "" {
274-
return &pb.ChaincodeMessage{Type: pb.ChaincodeMessage_ERROR, Payload: []byte(errMsg), Txid: txid}
275-
}
276-
277-
//not CONFIDENTIAL transaction, OK to call CC
278-
return nil
279-
}
280-
281264
func (handler *Handler) deregister() error {
282265
if handler.registered {
283266
handler.chaincodeSupport.deregisterHandler(handler)
@@ -1151,42 +1134,6 @@ func (handler *Handler) handleGetHistoryForKey(msg *pb.ChaincodeMessage) {
11511134
}()
11521135
}
11531136

1154-
// afterPutState handles a PUT_STATE request from the chaincode.
1155-
func (handler *Handler) afterPutState(e *fsm.Event, state string) {
1156-
_, ok := e.Args[0].(*pb.ChaincodeMessage)
1157-
if !ok {
1158-
e.Cancel(fmt.Errorf("Received unexpected message type"))
1159-
return
1160-
}
1161-
chaincodeLogger.Debugf("Received %s in state %s, invoking put state to ledger", pb.ChaincodeMessage_PUT_STATE, state)
1162-
1163-
// Put state into ledger handled within enterBusyState
1164-
}
1165-
1166-
// afterDelState handles a DEL_STATE request from the chaincode.
1167-
func (handler *Handler) afterDelState(e *fsm.Event, state string) {
1168-
_, ok := e.Args[0].(*pb.ChaincodeMessage)
1169-
if !ok {
1170-
e.Cancel(fmt.Errorf("Received unexpected message type"))
1171-
return
1172-
}
1173-
chaincodeLogger.Debugf("Received %s, invoking delete state from ledger", pb.ChaincodeMessage_DEL_STATE)
1174-
1175-
// Delete state from ledger handled within enterBusyState
1176-
}
1177-
1178-
// afterInvokeChaincode handles an INVOKE_CHAINCODE request from the chaincode.
1179-
func (handler *Handler) afterInvokeChaincode(e *fsm.Event, state string) {
1180-
_, ok := e.Args[0].(*pb.ChaincodeMessage)
1181-
if !ok {
1182-
e.Cancel(fmt.Errorf("Received unexpected message type"))
1183-
return
1184-
}
1185-
chaincodeLogger.Debugf("Received %s in state %s, invoking another chaincode", pb.ChaincodeMessage_INVOKE_CHAINCODE, state)
1186-
1187-
// Invoke another chaincode handled within enterBusyState
1188-
}
1189-
11901137
// Handles request to ledger to put state
11911138
func (handler *Handler) enterBusyState(e *fsm.Event, state string) {
11921139
go func() {

0 commit comments

Comments
 (0)