Using the default configuration I can run all the functions inside the application folder of commercial paper on test-network without any problem
If I edit the default signature policy in the approval and commitment of the chaincode definition i am unable to run the issue.js code without experiencing the service discovery error:
" Connect to Fabric gateway.
Use network channel: mychannel.
Use org.papernet.commercialpaper smart contract.
Submit commercial paper issue transaction.
2021-03-26T12:05:04.277Z - error: [DiscoveryService]: send[papercontract] - Channel:mychannel received discovery error:failed constructing descriptor for chaincodes:<name:"papercontract" >
Error processing transaction. Error: DiscoveryService: papercontract error: failed constructing descriptor for chaincodes:<name:"papercontract" >
Error: DiscoveryService: papercontract error: failed constructing descriptor for chaincodes:<name:"papercontract" >
at DiscoveryService.send (/home/sangieri/TestProject/commercial-paper/organization/magnetocorp/application/node_modules/fabric-common/lib/DiscoveryService.js:363:11)
Disconnect from Fabric gateway.
Issue program complete."
According to documentation, to edit the signature policy I use the following commands:
peer lifecycle chaincode approveformyorg --orderer localhost:7050 --ordererTLSHostnameOverride orderer.example.com --channelID mychannel --signature-policy "OR('Org1.peer', 'Org2.peer')" --name papercontract -v 0 --package-id $PACKAGE_ID --sequence 1 --tls --cafile $ORDERER_CA
peer lifecycle chaincode commit -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --peerAddresses localhost:7051 --tlsRootCertFiles ${PEER0_ORG1_CA} --peerAddresses localhost:9051 --tlsRootCertFiles ${PEER0_ORG2_CA} --channelID mychannel --signature-policy "OR('Org1.peer', 'Org2.peer')" --name papercontract -v 0 --sequence 1 --tls --cafile $ORDERER_CA --waitForEvent
The Anchor peer are set.
The connectionOptions in issue.js are set properly:
let connectionOptions = {
identity: userName,
wallet: wallet,
discovery: { enabled:true, asLocalhost: true }
};
Any help?