@@ -1086,7 +1086,7 @@ func TestGetTxContextFromHandler(t *testing.T) {
1086
1086
chnl := "test"
1087
1087
txid := "1"
1088
1088
// test getTxContext for TEST channel, tx=1, msgType=IVNOKE_CHAINCODE and empty payload - empty payload => expect to return empty txContext
1089
- txContext , _ := h .getTxContextForMessage (chnl , "1" , pb .ChaincodeMessage_INVOKE_CHAINCODE . String () , []byte ("" ), "[%s]No ledger context for %s. Sending %s" , 12345 , "TestCC" , pb .ChaincodeMessage_ERROR )
1089
+ txContext , _ := h .getTxContextForMessage (chnl , "1" , pb .ChaincodeMessage_INVOKE_CHAINCODE , []byte ("" ), "[%s]No ledger context for %s. Sending %s" , 12345 , "TestCC" , pb .ChaincodeMessage_ERROR )
1090
1090
if txContext != nil {
1091
1091
t .Fatalf ("expected empty txContext for empty payload" )
1092
1092
}
@@ -1105,14 +1105,14 @@ func TestGetTxContextFromHandler(t *testing.T) {
1105
1105
txCtxGenerated , payload := genNewPldAndCtxFromLdgr (t , "shimTestCC" , chnl , txid , pldgr , & h )
1106
1106
1107
1107
// test getTxContext for TEST channel, tx=1, msgType=IVNOKE_CHAINCODE and non empty payload => must return a non empty txContext
1108
- txContext , ccMsg := h .getTxContextForMessage (chnl , txid , pb .ChaincodeMessage_INVOKE_CHAINCODE . String () , payload ,
1108
+ txContext , ccMsg := h .getTxContextForMessage (chnl , txid , pb .ChaincodeMessage_INVOKE_CHAINCODE , payload ,
1109
1109
"[%s]No ledger context for %s. Sending %s" , 12345 , pb .ChaincodeMessage_INVOKE_CHAINCODE .String (), pb .ChaincodeMessage_ERROR )
1110
1110
if txContext == nil || ccMsg != nil || txContext != txCtxGenerated {
1111
1111
t .Fatalf ("expected successful txContext for non empty payload and INVOKE_CHAINCODE msgType. triggerNextStateMsg: %s." , ccMsg )
1112
1112
}
1113
1113
1114
1114
// test for another msgType (PUT_STATE) with the same payload ==> must return a non empty txContext
1115
- txContext , ccMsg = h .getTxContextForMessage (chnl , txid , pb .ChaincodeMessage_PUT_STATE . String () , payload ,
1115
+ txContext , ccMsg = h .getTxContextForMessage (chnl , txid , pb .ChaincodeMessage_PUT_STATE , payload ,
1116
1116
"[%s]No ledger context for %s. Sending %s" , 12345 , pb .ChaincodeMessage_PUT_STATE .String (), pb .ChaincodeMessage_ERROR )
1117
1117
if txContext == nil || ccMsg != nil || txContext != txCtxGenerated {
1118
1118
t .Fatalf ("expected successful txContext for non empty payload and PUT_STATE msgType. triggerNextStateMsg: %s." , ccMsg )
@@ -1125,7 +1125,7 @@ func TestGetTxContextFromHandler(t *testing.T) {
1125
1125
txCtxGenerated , payload = genNewPldAndCtxFromLdgr (t , "lscc" , chnl , txid , pldgr , & h )
1126
1126
1127
1127
// test getting a TxContext with an SCC without a channel => expect to return a non empty txContext
1128
- txContext , ccMsg = h .getTxContextForMessage (chnl , txid , pb .ChaincodeMessage_INVOKE_CHAINCODE . String () , payload ,
1128
+ txContext , ccMsg = h .getTxContextForMessage (chnl , txid , pb .ChaincodeMessage_INVOKE_CHAINCODE , payload ,
1129
1129
"[%s]No ledger context for %s. Sending %s" , 12345 , pb .ChaincodeMessage_INVOKE_CHAINCODE .String (), pb .ChaincodeMessage_ERROR )
1130
1130
if txContext == nil || ccMsg != nil || txContext != txCtxGenerated {
1131
1131
t .Fatalf ("expected successful txContext for non empty payload and INVOKE_CHAINCODE msgType. triggerNextStateMsg: %s." , ccMsg )
@@ -1137,7 +1137,7 @@ func TestGetTxContextFromHandler(t *testing.T) {
1137
1137
txCtxGenerated , payload = genNewPldAndCtxFromLdgr (t , "lscc" , chnl , txid , pldgr , & h )
1138
1138
1139
1139
// test getting a TxContext with an SCC with channel TEST => expect to return a non empty txContext
1140
- txContext , ccMsg = h .getTxContextForMessage (chnl , txid , pb .ChaincodeMessage_INVOKE_CHAINCODE . String () , payload ,
1140
+ txContext , ccMsg = h .getTxContextForMessage (chnl , txid , pb .ChaincodeMessage_INVOKE_CHAINCODE , payload ,
1141
1141
"[%s]No ledger context for %s. Sending %s" , 12345 , pb .ChaincodeMessage_INVOKE_CHAINCODE .String (), pb .ChaincodeMessage_ERROR )
1142
1142
if txContext == nil || ccMsg != nil || txContext != txCtxGenerated {
1143
1143
t .Fatalf ("expected successful txContext for non empty payload and INVOKE_CHAINCODE msgType. triggerNextStateMsg: %s." , ccMsg )
@@ -1148,7 +1148,7 @@ func TestGetTxContextFromHandler(t *testing.T) {
1148
1148
chnl = ""
1149
1149
txCtxGenerated , payload = genNewPldAndCtxFromLdgr (t , "shimTestCC" , chnl , txid , pldgr , & h )
1150
1150
// test getting a TxContext with an SCC with channel TEST => expect to return a non empty txContext
1151
- txContext , ccMsg = h .getTxContextForMessage (chnl , txid , pb .ChaincodeMessage_INVOKE_CHAINCODE . String () , payload ,
1151
+ txContext , ccMsg = h .getTxContextForMessage (chnl , txid , pb .ChaincodeMessage_INVOKE_CHAINCODE , payload ,
1152
1152
"[%s]No ledger context for %s. Sending %s" , 12345 , pb .ChaincodeMessage_INVOKE_CHAINCODE .String (), pb .ChaincodeMessage_ERROR )
1153
1153
if txContext == nil || ccMsg != nil || txContext != txCtxGenerated {
1154
1154
t .Fatalf ("expected successful txContext for non empty payload and INVOKE_CHAINCODE msgType. triggerNextStateMsg: %s." , ccMsg )
@@ -1158,7 +1158,7 @@ func TestGetTxContextFromHandler(t *testing.T) {
1158
1158
txid = "5"
1159
1159
payload = genNewPld (t , "shimTestCC" )
1160
1160
// test getting a TxContext with an SCC with channel TEST => expect to return a non empty txContext
1161
- txContext , ccMsg = h .getTxContextForMessage (chnl , txid , pb .ChaincodeMessage_INVOKE_CHAINCODE . String () , payload ,
1161
+ txContext , ccMsg = h .getTxContextForMessage (chnl , txid , pb .ChaincodeMessage_INVOKE_CHAINCODE , payload ,
1162
1162
"[%s]No ledger context for %s. Sending %s" , 12345 , pb .ChaincodeMessage_INVOKE_CHAINCODE .String (), pb .ChaincodeMessage_ERROR )
1163
1163
if txContext != nil || ccMsg == nil {
1164
1164
t .Fatal ("expected nil txContext for non empty payload and INVOKE_CHAINCODE msgType without the ledger generating a TxContext . unexpected non nil tcContext" )
@@ -1168,7 +1168,7 @@ func TestGetTxContextFromHandler(t *testing.T) {
1168
1168
txid = "6"
1169
1169
payload = genNewPld (t , "lscc" )
1170
1170
// test getting a TxContext with an SCC with channel TEST => expect to return a non empty txContext
1171
- txContext , ccMsg = h .getTxContextForMessage (chnl , txid , pb .ChaincodeMessage_INVOKE_CHAINCODE . String () , payload ,
1171
+ txContext , ccMsg = h .getTxContextForMessage (chnl , txid , pb .ChaincodeMessage_INVOKE_CHAINCODE , payload ,
1172
1172
"[%s]No ledger context for %s. Sending %s" , 12345 , pb .ChaincodeMessage_INVOKE_CHAINCODE .String (), pb .ChaincodeMessage_ERROR )
1173
1173
if txContext != nil || ccMsg == nil {
1174
1174
t .Fatal ("expected nil txContext for non empty payload and INVOKE_CHAINCODE msgType without the ledger generating a TxContext . unexpected non nil tcContext" )
0 commit comments