简体   繁体   中英

Hyperledger Fabric: " error validating ReadSet: readset expected key [Group] /Channel/Application at version 1, but got version 3"

Im facing a problem here, I created a channel with one organization ORG1 (using orderer orderer1), then I added ORG2 and then ORG3 by updating the channel config block using the cli command:

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

The next thing I want to do is to add one anchor peer for each organization. By running for each organization's anchor peer:

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

The error I'm getting from the orderer's logs is:

2019-01-01 13:50:19.095 UTC [orderer.common.broadcast] ProcessMessage -> WARN 076 [channel: mainchannel] Rejecting broadcast of config message from 172.25.0.23:39260 because of error: error authorizing update: error validating ReadSet: readset expected key [Group] /Channel/Application at version 1, but got version 3

Any idea what can I change to set the correct configuration version in the ORG1MSPanchors.tx file that I created before stating the network and creating the channel???

PS: The ORG1MSPanchors.tx file was generated from the configtx.yaml file by running:

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

The root cause is your version of /Channel/Application has upgraded to 3 after 2 times added new organizations. But from "configtxgen --help" you can see below:

 -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)

So for the non-frist update, you have to edit this ORG1MSPanchors.tx by yourself:

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

Then change both "payload.data.config_update.read_set.groups.Application.version" and "payload.data.config_update.write_set.groups.Application.version" to version 3, and encode back:

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

Now you can use "peer channel update" to update anchor peer for ORG1.

In fact, the official steps should be https://hyperledger-fabric.readthedocs.io/en/latest/channel_update_tutorial.html#updating-the-channel-config-to-include-an-org3-anchor-peer-optional

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM