@@ -571,9 +571,8 @@ func checkFinalState(cccid *ccprovider.CCContext) error {
571
571
572
572
// Invoke chaincode_example02
573
573
func invokeExample02Transaction (ctxt context.Context , cccid * ccprovider.CCContext , cID * pb.ChaincodeID , chaincodeType pb.ChaincodeSpec_Type , args []string , destroyImage bool ) error {
574
-
575
- var nextBlockNumber uint64
576
-
574
+ // the ledger is created with genesis block. Start block number 1 onwards
575
+ var nextBlockNumber uint64 = 1
577
576
f := "init"
578
577
argsDeploy := util .ToChaincodeArgs (f , "a" , "100" , "b" , "200" )
579
578
spec := & pb.ChaincodeSpec {Type : chaincodeType , ChaincodeId : cID , Input : & pb.ChaincodeInput {Args : argsDeploy }}
@@ -645,7 +644,7 @@ func runChaincodeInvokeChaincode(t *testing.T, chainID1 string, chainID2 string,
645
644
sProp , prop := putils .MockSignedEndorserProposalOrPanic (chainID1 , spec1 , []byte ([]byte ("Alice" )), nil )
646
645
cccid1 := ccprovider .NewCCContext (chainID1 , "example02" , "0" , "" , false , sProp , prop )
647
646
648
- var nextBlockNumber uint64
647
+ var nextBlockNumber uint64 = 1
649
648
650
649
_ , err = deploy (ctxt , cccid1 , spec1 , nextBlockNumber )
651
650
nextBlockNumber ++
@@ -741,7 +740,7 @@ func runChaincodeInvokeChaincode(t *testing.T, chainID1 string, chainID2 string,
741
740
sProp , prop = putils .MockSignedEndorserProposalOrPanic (chainID2 , spec3 , []byte ([]byte ("Alice" )), nil )
742
741
cccid3 := ccprovider .NewCCContext (chainID2 , "example04" , "0" , "" , false , sProp , prop )
743
742
744
- _ , err = deploy (ctxt , cccid3 , spec3 , 0 )
743
+ _ , err = deploy (ctxt , cccid3 , spec3 , 1 )
745
744
chaincodeID2 := spec2 .ChaincodeId .Name
746
745
if err != nil {
747
746
t .Fail ()
@@ -764,7 +763,7 @@ func runChaincodeInvokeChaincode(t *testing.T, chainID1 string, chainID2 string,
764
763
//var uuid string
765
764
766
765
// Bob should not be able to call
767
- _ , _ , _ , err = invoke (ctxt , chainID2 , spec2 , 1 , []byte ("Bob" ))
766
+ _ , _ , _ , err = invoke (ctxt , chainID2 , spec2 , 2 , []byte ("Bob" ))
768
767
if err == nil {
769
768
t .Fail ()
770
769
t .Logf ("Bob invoking <%s> should fail. It did not happen instead: %s" , chaincodeID2 , err )
@@ -775,7 +774,7 @@ func runChaincodeInvokeChaincode(t *testing.T, chainID1 string, chainID2 string,
775
774
}
776
775
777
776
// Alice should be able to call
778
- _ , _ , _ , err = invoke (ctxt , chainID2 , spec2 , 1 , []byte ("Alice" ))
777
+ _ , _ , _ , err = invoke (ctxt , chainID2 , spec2 , 2 , []byte ("Alice" ))
779
778
if err != nil {
780
779
t .Fail ()
781
780
t .Logf ("Alice invoking <%s> should not fail. It did happen instead: %s" , chaincodeID2 , err )
@@ -953,7 +952,7 @@ func TestChaincodeInvokeChaincodeErrorCase(t *testing.T) {
953
952
sProp , prop := putils .MockSignedEndorserProposalOrPanic (util .GetTestChainID (), spec1 , []byte ([]byte ("Alice" )), nil )
954
953
cccid1 := ccprovider .NewCCContext (chainID , "example02" , "0" , "" , false , sProp , prop )
955
954
956
- var nextBlockNumber uint64
955
+ var nextBlockNumber uint64 = 1
957
956
958
957
_ , err = deploy (ctxt , cccid1 , spec1 , nextBlockNumber )
959
958
nextBlockNumber ++
@@ -1044,7 +1043,7 @@ func TestQueries(t *testing.T) {
1044
1043
1045
1044
cccid := ccprovider .NewCCContext (chainID , "tmap" , "0" , "" , false , nil , nil )
1046
1045
1047
- var nextBlockNumber uint64
1046
+ var nextBlockNumber uint64 = 1
1048
1047
_ , err = deploy (ctxt , cccid , spec , nextBlockNumber )
1049
1048
nextBlockNumber ++
1050
1049
ccID := spec .ChaincodeId .Name
@@ -1398,7 +1397,7 @@ func TestGetEvent(t *testing.T) {
1398
1397
spec := & pb.ChaincodeSpec {Type : 1 , ChaincodeId : cID , Input : & pb.ChaincodeInput {Args : util .ToChaincodeArgs (f )}}
1399
1398
1400
1399
cccid := ccprovider .NewCCContext (chainID , "esender" , "0" , "" , false , nil , nil )
1401
- var nextBlockNumber uint64
1400
+ var nextBlockNumber uint64 = 1
1402
1401
_ , err = deploy (ctxt , cccid , spec , nextBlockNumber )
1403
1402
nextBlockNumber ++
1404
1403
ccID := spec .ChaincodeId .Name
@@ -1580,7 +1579,7 @@ func TestChaincodeInvokesForbiddenSystemChaincode(t *testing.T) {
1580
1579
1581
1580
var ctxt = context .Background ()
1582
1581
1583
- var nextBlockNumber uint64
1582
+ var nextBlockNumber uint64 = 1
1584
1583
1585
1584
// Deploy second chaincode
1586
1585
url := "github.com/hyperledger/fabric/examples/chaincode/go/passthru"
@@ -1635,7 +1634,7 @@ func TestChaincodeInvokesSystemChaincode(t *testing.T) {
1635
1634
1636
1635
var ctxt = context .Background ()
1637
1636
1638
- var nextBlockNumber uint64
1637
+ var nextBlockNumber uint64 = 1
1639
1638
1640
1639
// Deploy second chaincode
1641
1640
url := "github.com/hyperledger/fabric/examples/chaincode/go/passthru"
0 commit comments