Hyperledger Fabric:“错误验证ReadSet:版本1的readset预期键[Group] / Channel / Application,但版本3”

时间:2019-01-01 21:20:55

标签: hyperledger-fabric

我在这里遇到问题,我使用一个组织ORG1(使用orderer orderer1)创建了一个频道,然后通过使用cli命令更新频道配置块添加了ORG2和ORG3:

peer channel update -f nada_update_in_envelope.pb -c $CHANNEL_NAME -o orderer.example.com:7050 --tls --cafile $ORDERER_CA

我下一步要做的是为每个组织添加一个锚点对等体。 通过为每个组织的锚点运行:

peer channel update -o orderer1.example.com:7050 -c mainchannel -f channel-artifacts/org1/channels/mainchannel/mainchannel/ORG1MSPanchors.tx --tls --cafile <path>

我从订购者的日志中得到的错误是:

  

2019-01-01 13:50:19.095 UTC [orderer.common.broadcast] ProcessMessage   -> WARN 076 [channel:mainchannel]由于错误而拒绝从172.25.0.23:39260广播配置消息:错误授权   更新:验证ReadSet时出错:readset预期键[组]   / Channel / Application的版本为1,但版本为3

任何想法,在说明网络和创建通道之前,我可以更改什么以在我创建的ORG1MSPanchors.tx文件中设置正确的配置版本?

P.S: 通过运行以下命令从configtx.yaml文件生成ORG1MSPanchors.tx文件:

../bin/configtxgen -profile OneOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/ORG1MSPanchors.tx -channelID mainchannel -asOrg ORG1MSP

1 个答案:

答案 0 :(得分:0)

根本原因是您的 /Channel/Application 版本在添加了 2 次新组织后已升级到 3。但是从“configtxgen --help”你可以看到下面的内容:

 -outputAnchorPeersUpdate string
        [DEPRECATED] Creates a config update to update an anchor peer (works only with the default channel creation, and only for the first update)

因此对于非第一次更新,您必须自己编辑此 ORG1MSPanchors.tx:

configtxlator proto_decode --input ./channel-artifacts/ORG1MSPanchors.tx --type common.Envelope >channel-artifacts/ORG1MSPanchors.json

然后将“payload.data.config_update.read_set.groups.Application.version”和“payload.data.config_update.write_set.groups.Application.version”都更改为版本3,然后编码回来:

 configtxlator proto_encode --input ./channel-artifacts/ORG1MSPanchors.json  --type common.Envelope >./channel-artifacts/ORG1MSPanchors.tx

现在您可以使用“peer channel update”来更新 ORG1 的锚点。

其实官方的步骤应该是https://hyperledger-fabric.readthedocs.io/en/latest/channel_update_tutorial.html#updating-the-channel-config-to-include-an-org3-anchor-peer-optional