@@ -25,7 +25,6 @@ import (
25
25
"testing"
26
26
"time"
27
27
28
- "io/ioutil"
29
28
"os"
30
29
"path/filepath"
31
30
@@ -35,6 +34,7 @@ import (
35
34
"github.com/hyperledger/fabric/core/container"
36
35
"github.com/hyperledger/fabric/core/crypto"
37
36
"github.com/hyperledger/fabric/core/ledger"
37
+ "github.com/hyperledger/fabric/core/util"
38
38
"github.com/hyperledger/fabric/membersrvc/ca"
39
39
pb "github.com/hyperledger/fabric/protos"
40
40
"github.com/op/go-logging"
@@ -175,7 +175,7 @@ func deploy(admCert crypto.CertificateHandler) error {
175
175
spec := & pb.ChaincodeSpec {
176
176
Type : 1 ,
177
177
ChaincodeID : & pb.ChaincodeID {Name : "mycc" },
178
- CtorMsg : & pb.ChaincodeInput {Function : "init" , Args : [] string {} },
178
+ CtorMsg : & pb.ChaincodeInput {Args : util . ToChaincodeArgs ( "init" ) },
179
179
Metadata : admCert .GetCertificate (),
180
180
ConfidentialityLevel : pb .ConfidentialityLevel_PUBLIC ,
181
181
}
@@ -197,7 +197,7 @@ func deploy(admCert crypto.CertificateHandler) error {
197
197
198
198
ledger , err := ledger .GetLedger ()
199
199
ledger .BeginTxBatch ("1" )
200
- _ , err = chaincode .Execute (ctx , chaincode .GetChain (chaincode .DefaultChain ), transaction )
200
+ _ , _ , err = chaincode .Execute (ctx , chaincode .GetChain (chaincode .DefaultChain ), transaction )
201
201
if err != nil {
202
202
return fmt .Errorf ("Error deploying chaincode: %s" , err )
203
203
}
@@ -222,7 +222,7 @@ func addRole(admCert crypto.CertificateHandler, idCert crypto.CertificateHandler
222
222
return err
223
223
}
224
224
225
- chaincodeInput := & pb.ChaincodeInput {Function : "addRole" , Args : [] string { string (idCert .GetCertificate ()), role } }
225
+ chaincodeInput := & pb.ChaincodeInput {Args : util . ToChaincodeArgs ( "addRole" , string (idCert .GetCertificate ()), role ) }
226
226
chaincodeInputRaw , err := proto .Marshal (chaincodeInput )
227
227
if err != nil {
228
228
return err
@@ -263,7 +263,7 @@ func addRole(admCert crypto.CertificateHandler, idCert crypto.CertificateHandler
263
263
264
264
ledger , err := ledger .GetLedger ()
265
265
ledger .BeginTxBatch ("1" )
266
- _ , err = chaincode .Execute (ctx , chaincode .GetChain (chaincode .DefaultChain ), transaction )
266
+ _ , _ , err = chaincode .Execute (ctx , chaincode .GetChain (chaincode .DefaultChain ), transaction )
267
267
if err != nil {
268
268
return fmt .Errorf ("Error deploying chaincode: %s" , err )
269
269
}
@@ -289,7 +289,7 @@ func write(invoker crypto.Client, invokerCert crypto.CertificateHandler, value [
289
289
return err
290
290
}
291
291
292
- chaincodeInput := & pb.ChaincodeInput {Function : "write" , Args : [] string { string (value )} }
292
+ chaincodeInput := & pb.ChaincodeInput {Args : util . ToChaincodeArgs ( "write" , string (value )) }
293
293
chaincodeInputRaw , err := proto .Marshal (chaincodeInput )
294
294
if err != nil {
295
295
return err
@@ -330,7 +330,7 @@ func write(invoker crypto.Client, invokerCert crypto.CertificateHandler, value [
330
330
331
331
ledger , err := ledger .GetLedger ()
332
332
ledger .BeginTxBatch ("1" )
333
- _ , err = chaincode .Execute (ctx , chaincode .GetChain (chaincode .DefaultChain ), transaction )
333
+ _ , _ , err = chaincode .Execute (ctx , chaincode .GetChain (chaincode .DefaultChain ), transaction )
334
334
if err != nil {
335
335
return fmt .Errorf ("Error deploying chaincode: %s" , err )
336
336
}
@@ -357,7 +357,7 @@ func read(invoker crypto.Client, invokerCert crypto.CertificateHandler) ([]byte,
357
357
return nil , err
358
358
}
359
359
360
- chaincodeInput := & pb.ChaincodeInput {Function : "read" , Args : [] string {} }
360
+ chaincodeInput := & pb.ChaincodeInput {Args : util . ToChaincodeArgs ( "read" ) }
361
361
chaincodeInputRaw , err := proto .Marshal (chaincodeInput )
362
362
if err != nil {
363
363
return nil , err
@@ -398,7 +398,7 @@ func read(invoker crypto.Client, invokerCert crypto.CertificateHandler) ([]byte,
398
398
399
399
ledger , err := ledger .GetLedger ()
400
400
ledger .BeginTxBatch ("1" )
401
- result , err := chaincode .Execute (ctx , chaincode .GetChain (chaincode .DefaultChain ), transaction )
401
+ result , _ , err := chaincode .Execute (ctx , chaincode .GetChain (chaincode .DefaultChain ), transaction )
402
402
if err != nil {
403
403
return nil , fmt .Errorf ("Error deploying chaincode: %s" , err )
404
404
}
@@ -440,7 +440,6 @@ func setup() {
440
440
}
441
441
442
442
func initMemershipServices () {
443
- ca .LogInit (ioutil .Discard , os .Stdout , os .Stdout , os .Stderr , os .Stdout )
444
443
ca .CacheConfiguration () // Cache configuration
445
444
eca = ca .NewECA ()
446
445
tca = ca .NewTCA (eca )
0 commit comments