即使得到所有组织的批准,也无法提交链码



我已经从渠道的所有组织批准了链码。如下所示,checkcommitereadiness命令将输出批准的json。

#peer lifecycle chaincode checkcommitreadiness -o localhost:9050 --channelID supplychain-channel --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/freight.example.com/orderers/orderer0.freight.example.com/msp/tlscacerts/tlsca.freight.example.com-cert.pem --name supplychain --version 1.0 --sequence 1 --output json --init-required --signature-policy "AND ('ShipperMSP.peer','FreightMSP.peer','CarrierMSP.peer','CustomMSP.peer','ConsigneeMSP.peer')"
{
"approvals": {
"CarrierMSP": true,
"ConsigneeMSP": true,
"CustomMSP": true,
"FreightMSP": true,
"ShipperMSP": true
}
}

但是当我提交时,我得到下面的错误

#peer lifecycle chaincode commit -o orderer0.freight.example.com:9050 --ordererTLSHostnameOverride orderer0.freight.example.com --tls --version 1.0 --sequence 1 --init-required --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/freight.example.com/orderers/orderer0.freight.example.com/msp/tlscacerts/tlsca.freight.example.com-cert.pem --channelID supplychain-channel --name supplychain
Error: proposal failed with status: 500 - failed to invoke backing implementation of 'CommitChaincodeDefinition': chaincode definition not agreed to by this org (FreightMSP)

它是一个使用docker swarm托管的多主机fabric网络。虽然我能够在主机本身的链码生命周期中提交命令之前执行所有命令。但是我得到了这个错误

Error: failed to retrieve endorser client for commit: endorser client failed to connect to localhost:7051: failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 127.0.0.1:7051: connect: connection refused"

因此,为了与群集网络中的所有节点通信,我试图从CLI容器执行提交命令,并且我得到'未能调用'CommitChaincodeDefinition'的支持实现';错误。

只需为提交添加——signature-policy:

peer lifecycle chaincode commit -o orderer0.freight.example.com:9050 --ordererTLSHostnameOverride orderer0.freight.example.com --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/freight.example.com/orderers/orderer0.freight.example.com/msp/tlscacerts/tlsca.freight.example.com-cert.pem --channelID supplychain-channel --name supplychain --peerAddresses peer0.shipper.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/shipper.example.com/peers/peer0.shipper.example.com/tls/ca.crt --peerAddresses peer0.freight.example.com:9051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/freight.example.com/peers/peer0.freight.example.com/tls/ca.crt --peerAddresses peer0.carrier.example.com:11051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/carrier.example.com/peers/peer0.carrier.example.com/tls/ca.crt --peerAddresses peer0.custom.example.com:13051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/custom.example.com/peers/peer0.custom.example.com/tls/ca.crt --peerAddresses peer0.consignee.example.com:15051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/consignee.example.com/peers/peer0.consignee.example.com/tls/ca.crt --version 1 --sequence 1 --init-required --signature-policy "AND ('ShipperMSP.peer','FreightMSP.peer','CarrierMSP.peer','CustomMSP.peer','ConsigneeMSP.peer')"