链码构造描述符失败

时间:2020-10-20 20:48:50

标签: hyperledger-fabric hyperledger-fabric-sdk-js

我正在尝试与用户进行交易,但是当我尝试获取频道时,会出现此错误:

微服务日志:

error: [DiscoveryService]: send[mychannel] - Channel:mychannel received discovery error:failed constructing descriptor for chaincodes:<name:"mychannel" >
createTransaction Error: Cannot do transaction in blockchain: DiscoveryService: mychannel error: failed constructing descriptor for chaincodes:<name:"mychannel" >
at FabricRepository.<anonymous> (/app/microservice/dist/services/blockchain-client.js:235:23)
at Generator.throw (<anonymous>)
at rejected (/app/microservice/dist/services/blockchain-client.js:6:65)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
POST /fabric-service/createTransaction 997.103

对等日志:

2020-10-20 20:23:54.218 UTC [discovery.endorsement] func1 -> DEBU d98 Endpoint: peer0.org2.com:7052, InternalEndpoint: , PKI-ID: 82f87b1ae00364c30ce6293dd804af5f81462b137b8e4d151580b9fcafa9b4c9, Metadata:  satisfies principal principal:"\n\013Org2MSP\020\003" 
2020-10-20 20:23:54.218 UTC [discovery.endorsement] func1 -> DEBU d99 Endpoint: peer0.org2.com:7052, InternalEndpoint: , PKI-ID: 82f87b1ae00364c30ce6293dd804af5f81462b137b8e4d151580b9fcafa9b4c9, Metadata:  doesn't satisfy principal principal:"\n\007Org2MSP\020\003"  : the identity is a member of a different MSP (expected Org1MSP, got Org2MSP)
2020-10-20 20:23:54.218 UTC [discovery] chaincodeQuery -> ERRO d9a Failed constructing descriptor for chaincode chaincodes:<name:"mychannel" > ,: no peer combination can satisfy the endorsement policy

Configtx:

    mychannel:
        Consortium: MyConsortium
        <<: *ChannelDefaults
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org1
                - *Org2
            Capabilities:
                <<: *ApplicationCapabilities

总的来说,如果我正在从org1对等方执行相同的事务,那么对等方都将收到类似的错误,都将失败。如果我从联合体中删除一个组织,则该组织正在该组织中工作,但是当这两个组织都存在时,则无法工作

有什么办法解决这个问题吗?

3 个答案:

答案 0 :(得分:1)

如果 Chaincode 未实例化或未在通道中定义,有时会发生这种情况。最好检查 Docker 容器以了解此错误背后的原因。 如果您正在运行 FB 测试网络,您可以使用

./monitordocker.sh fabric_test

答案 1 :(得分:0)

问题可能出在configtx.yaml,您必须正确放置所有“ MSPDir”,并且在发出命令时,必须根据该“ MSPDir”设置环境变量。

答案 2 :(得分:0)

所以问题出在脚本上,该脚本为组织创建锚点对等,错误通过bash泄漏。在为两个组织添加锚点后,事情就解决了,我可以进行交易了。