I am using Hyperledger Fabric v2.3.1.I am trying to approve my chaincode definition with argument --signature-policy "OR('Org1MSP.peer','Org2MSP.peer')" instead of the default endorsement for the test-network. The whole command is below
peer lifecycle chaincode approveformyorg -o orderer.example.com:7050 \
--tls --cafile $ORDERER_CA --channelID mychannel --name fabcar \
--version 1.0 \
--package-id fabcar_1:762e0fe3dbeee0f7b08fb6200adeb4a3a20f649a00f168c0b3c2257e53b6e506 \
--sequence 1 --signature-policy "OR ('Org1MSP.peer','Org2MSP.peer')"
And I get this result
2021-06-09 11:56:14.132 CST [chaincodeCmd] ClientWait -> INFO 001 txid [f77193563630eaca758a4e3e360e77625be3bba51a7ac361e0353291a9441ffc] committed with status (VALID) at localhost:7051
However, when I commit the chaincode definition(the whole command is below), I got this error message
peer lifecycle chaincode commit -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile $ORDERER_CA --channelID mychannel --name fabcar --peerAddresses localhost:7051 --tlsRootCertFiles $PEER_CA --version 1.0 --sequence 1
Error: proposal failed with status: 500 - failed to invoke backing implementation of 'CommitChaincodeDefinition': chaincode definition not agreed to by this org (Org1MSP)
What's wrong with it?
add flag --signature-policy
when you commit your chaincode,like these
peer lifecycle chaincode commit -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile $ORDERER_CA --channelID mychannel --name fabcar --peerAddresses localhost:7051 --tlsRootCertFiles $PEER_CA --version 1.0 --sequence 1 --signature-policy "OR ('Org1MSP.peer','Org2MSP.peer')"