@@ -24,13 +24,12 @@ import (
24
24
"testing"
25
25
"time"
26
26
27
+ "github.com/hyperledger/fabric/common/flogging"
27
28
mockpeer "github.com/hyperledger/fabric/common/mocks/peer"
28
29
"github.com/hyperledger/fabric/common/util"
29
30
lproto "github.com/hyperledger/fabric/protos/ledger/queryresult"
30
31
pb "github.com/hyperledger/fabric/protos/peer"
31
32
"github.com/hyperledger/fabric/protos/utils"
32
-
33
- "github.com/hyperledger/fabric/common/flogging"
34
33
"github.com/op/go-logging"
35
34
"github.com/spf13/viper"
36
35
"github.com/stretchr/testify/assert"
@@ -585,7 +584,7 @@ func TestInvoke(t *testing.T) {
585
584
586
585
peerSide .Send (& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_READY , Txid : "1" })
587
586
588
- ci := & pb.ChaincodeInput {[][]byte {[]byte ("init" ), []byte ("A" ), []byte ("100" ), []byte ("B" ), []byte ("200" )}}
587
+ ci := & pb.ChaincodeInput {[][]byte {[]byte ("init" ), []byte ("A" ), []byte ("100" ), []byte ("B" ), []byte ("200" )}, nil }
589
588
payload := utils .MarshalOrPanic (ci )
590
589
respSet := & mockpeer.MockResponseSet {errorFunc , errorFunc , []* mockpeer.MockResponse {
591
590
& mockpeer.MockResponse {& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_PUT_STATE , Txid : "2" }, & pb.ChaincodeMessage {Type : pb .ChaincodeMessage_RESPONSE , Txid : "2" }},
@@ -608,7 +607,7 @@ func TestInvoke(t *testing.T) {
608
607
& mockpeer.MockResponse {& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_COMPLETED , Txid : "3" }, nil }}}
609
608
peerSide .SetResponses (respSet )
610
609
611
- ci = & pb.ChaincodeInput {[][]byte {[]byte ("invoke" ), []byte ("A" ), []byte ("B" ), []byte ("10" )}}
610
+ ci = & pb.ChaincodeInput {[][]byte {[]byte ("invoke" ), []byte ("A" ), []byte ("B" ), []byte ("10" )}, nil }
612
611
payload = utils .MarshalOrPanic (ci )
613
612
peerSide .Send (& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_TRANSACTION , Payload : payload , Txid : "3" })
614
613
@@ -623,7 +622,7 @@ func TestInvoke(t *testing.T) {
623
622
& mockpeer.MockResponse {& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_COMPLETED , Txid : "3a" }, nil }}}
624
623
peerSide .SetResponses (respSet )
625
624
626
- ci = & pb.ChaincodeInput {[][]byte {[]byte ("invoke" ), []byte ("A" ), []byte ("B" ), []byte ("10" )}}
625
+ ci = & pb.ChaincodeInput {[][]byte {[]byte ("invoke" ), []byte ("A" ), []byte ("B" ), []byte ("10" )}, nil }
627
626
payload = utils .MarshalOrPanic (ci )
628
627
peerSide .Send (& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_TRANSACTION , Payload : payload , Txid : "3a" })
629
628
@@ -636,7 +635,7 @@ func TestInvoke(t *testing.T) {
636
635
& mockpeer.MockResponse {& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_COMPLETED , Txid : "3b" }, nil }}}
637
636
peerSide .SetResponses (respSet )
638
637
639
- ci = & pb.ChaincodeInput {[][]byte {[]byte ("invoke" ), []byte ("A" ), []byte ("B" ), []byte ("10" )}}
638
+ ci = & pb.ChaincodeInput {[][]byte {[]byte ("invoke" ), []byte ("A" ), []byte ("B" ), []byte ("10" )}, nil }
640
639
payload = utils .MarshalOrPanic (ci )
641
640
peerSide .Send (& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_TRANSACTION , Payload : payload , Txid : "3b" })
642
641
@@ -649,7 +648,7 @@ func TestInvoke(t *testing.T) {
649
648
& mockpeer.MockResponse {& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_COMPLETED , Txid : "4" }, nil }}}
650
649
peerSide .SetResponses (respSet )
651
650
652
- ci = & pb.ChaincodeInput {[][]byte {[]byte ("delete" ), []byte ("A" )}}
651
+ ci = & pb.ChaincodeInput {[][]byte {[]byte ("delete" ), []byte ("A" )}, nil }
653
652
payload = utils .MarshalOrPanic (ci )
654
653
peerSide .Send (& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_TRANSACTION , Payload : payload , Txid : "4" })
655
654
@@ -662,7 +661,7 @@ func TestInvoke(t *testing.T) {
662
661
& mockpeer.MockResponse {& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_COMPLETED , Txid : "4a" }, nil }}}
663
662
peerSide .SetResponses (respSet )
664
663
665
- ci = & pb.ChaincodeInput {[][]byte {[]byte ("delete" ), []byte ("A" )}}
664
+ ci = & pb.ChaincodeInput {[][]byte {[]byte ("delete" ), []byte ("A" )}, nil }
666
665
payload = utils .MarshalOrPanic (ci )
667
666
peerSide .Send (& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_TRANSACTION , Payload : payload , Txid : "4a" })
668
667
@@ -674,7 +673,7 @@ func TestInvoke(t *testing.T) {
674
673
& mockpeer.MockResponse {& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_COMPLETED , Txid : "5" }, nil }}}
675
674
peerSide .SetResponses (respSet )
676
675
677
- ci = & pb.ChaincodeInput {[][]byte {[]byte ("badinvoke" )}}
676
+ ci = & pb.ChaincodeInput {[][]byte {[]byte ("badinvoke" )}, nil }
678
677
payload = utils .MarshalOrPanic (ci )
679
678
peerSide .Send (& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_TRANSACTION , Payload : payload , Txid : "5" })
680
679
@@ -700,7 +699,7 @@ func TestInvoke(t *testing.T) {
700
699
& mockpeer.MockResponse {& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_COMPLETED , Txid : "6" }, nil }}}
701
700
peerSide .SetResponses (respSet )
702
701
703
- ci = & pb.ChaincodeInput {[][]byte {[]byte ("rangeq" ), []byte ("A" ), []byte ("B" )}}
702
+ ci = & pb.ChaincodeInput {[][]byte {[]byte ("rangeq" ), []byte ("A" ), []byte ("B" )}, nil }
704
703
payload = utils .MarshalOrPanic (ci )
705
704
peerSide .Send (& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_TRANSACTION , Payload : payload , Txid : "6" })
706
705
@@ -715,7 +714,7 @@ func TestInvoke(t *testing.T) {
715
714
& mockpeer.MockResponse {& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_COMPLETED , Txid : "6a" }, nil }}}
716
715
peerSide .SetResponses (respSet )
717
716
718
- ci = & pb.ChaincodeInput {[][]byte {[]byte ("rangeq" ), []byte ("A" ), []byte ("B" )}}
717
+ ci = & pb.ChaincodeInput {[][]byte {[]byte ("rangeq" ), []byte ("A" ), []byte ("B" )}, nil }
719
718
payload = utils .MarshalOrPanic (ci )
720
719
peerSide .Send (& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_TRANSACTION , Payload : payload , Txid : "6a" })
721
720
@@ -732,7 +731,7 @@ func TestInvoke(t *testing.T) {
732
731
& mockpeer.MockResponse {& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_COMPLETED , Txid : "6b" }, nil }}}
733
732
peerSide .SetResponses (respSet )
734
733
735
- ci = & pb.ChaincodeInput {[][]byte {[]byte ("rangeq" ), []byte ("A" ), []byte ("B" )}}
734
+ ci = & pb.ChaincodeInput {[][]byte {[]byte ("rangeq" ), []byte ("A" ), []byte ("B" )}, nil }
736
735
payload = utils .MarshalOrPanic (ci )
737
736
peerSide .Send (& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_TRANSACTION , Payload : payload , Txid : "6b" })
738
737
@@ -749,7 +748,7 @@ func TestInvoke(t *testing.T) {
749
748
& mockpeer.MockResponse {& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_COMPLETED , Txid : "6c" }, nil }}}
750
749
peerSide .SetResponses (respSet )
751
750
752
- ci = & pb.ChaincodeInput {[][]byte {[]byte ("rangeq" ), []byte ("A" ), []byte ("B" )}}
751
+ ci = & pb.ChaincodeInput {[][]byte {[]byte ("rangeq" ), []byte ("A" ), []byte ("B" )}, nil }
753
752
payload = utils .MarshalOrPanic (ci )
754
753
peerSide .Send (& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_TRANSACTION , Payload : payload , Txid : "6c" })
755
754
@@ -771,7 +770,7 @@ func TestInvoke(t *testing.T) {
771
770
& mockpeer.MockResponse {& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_COMPLETED , Txid : "7" }, nil }}}
772
771
peerSide .SetResponses (respSet )
773
772
774
- ci = & pb.ChaincodeInput {[][]byte {[]byte ("historyq" ), []byte ("A" )}}
773
+ ci = & pb.ChaincodeInput {[][]byte {[]byte ("historyq" ), []byte ("A" )}, nil }
775
774
payload = utils .MarshalOrPanic (ci )
776
775
peerSide .Send (& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_TRANSACTION , Payload : payload , Txid : "7" })
777
776
@@ -786,7 +785,7 @@ func TestInvoke(t *testing.T) {
786
785
& mockpeer.MockResponse {& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_COMPLETED , Txid : "7a" }, nil }}}
787
786
peerSide .SetResponses (respSet )
788
787
789
- ci = & pb.ChaincodeInput {[][]byte {[]byte ("historyq" ), []byte ("A" )}}
788
+ ci = & pb.ChaincodeInput {[][]byte {[]byte ("historyq" ), []byte ("A" )}, nil }
790
789
payload = utils .MarshalOrPanic (ci )
791
790
peerSide .Send (& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_TRANSACTION , Payload : payload , Txid : "7a" })
792
791
@@ -812,7 +811,7 @@ func TestInvoke(t *testing.T) {
812
811
& mockpeer.MockResponse {& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_COMPLETED , Txid : "8" }, nil }}}
813
812
peerSide .SetResponses (respSet )
814
813
815
- ci = & pb.ChaincodeInput {[][]byte {[]byte ("richq" ), []byte ("A" )}}
814
+ ci = & pb.ChaincodeInput {[][]byte {[]byte ("richq" ), []byte ("A" )}, nil }
816
815
payload = utils .MarshalOrPanic (ci )
817
816
peerSide .Send (& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_TRANSACTION , Payload : payload , Txid : "8" })
818
817
@@ -826,7 +825,7 @@ func TestInvoke(t *testing.T) {
826
825
& mockpeer.MockResponse {& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_COMPLETED , Txid : "8a" }, nil }}}
827
826
peerSide .SetResponses (respSet )
828
827
829
- ci = & pb.ChaincodeInput {[][]byte {[]byte ("richq" ), []byte ("A" )}}
828
+ ci = & pb.ChaincodeInput {[][]byte {[]byte ("richq" ), []byte ("A" )}, nil }
830
829
payload = utils .MarshalOrPanic (ci )
831
830
peerSide .Send (& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_TRANSACTION , Payload : payload , Txid : "8a" })
832
831
@@ -907,7 +906,7 @@ func TestCC2CC(t *testing.T) {
907
906
908
907
peerSide .Send (& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_READY , Txid : "1" })
909
908
910
- ci := & pb.ChaincodeInput {[][]byte {[]byte ("init" ), []byte ("A" ), []byte ("100" ), []byte ("B" ), []byte ("200" )}}
909
+ ci := & pb.ChaincodeInput {[][]byte {[]byte ("init" ), []byte ("A" ), []byte ("100" ), []byte ("B" ), []byte ("200" )}, nil }
911
910
payload := utils .MarshalOrPanic (ci )
912
911
respSet := & mockpeer.MockResponseSet {errorFunc , errorFunc , []* mockpeer.MockResponse {
913
912
& mockpeer.MockResponse {& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_PUT_STATE , Txid : "2" }, & pb.ChaincodeMessage {Type : pb .ChaincodeMessage_RESPONSE , Txid : "2" }},
@@ -929,7 +928,7 @@ func TestCC2CC(t *testing.T) {
929
928
& mockpeer.MockResponse {& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_COMPLETED , Txid : "3" }, nil }}}
930
929
peerSide .SetResponses (respSet )
931
930
932
- ci = & pb.ChaincodeInput {[][]byte {[]byte ("cc2cc" ), []byte ("othercc" ), []byte ("arg1" ), []byte ("arg2" )}}
931
+ ci = & pb.ChaincodeInput {[][]byte {[]byte ("cc2cc" ), []byte ("othercc" ), []byte ("arg1" ), []byte ("arg2" )}, nil }
933
932
payload = utils .MarshalOrPanic (ci )
934
933
peerSide .Send (& pb.ChaincodeMessage {Type : pb .ChaincodeMessage_TRANSACTION , Payload : payload , Txid : "3" })
935
934
0 commit comments