Improve error message for private data not available on a peer
Improve message "private data matching public hash version is not available. Public hash version = %s, Private data version = %s" to indicate the actual issue, that is, private data wasn’t distributed to that peer collection member for a specific key and therefore the peer can’t endorse future transactions for the key.
I'm getting this error when trying to read another Orgs private collection withmemberOnlyRead:false does this have to do with distribution
Copying the response sent on mailing list here.
Org2 cannot query Org1 private data on their own Org2 peer. The whole point of private data is that it stays private to Org1 and only Org1 can choose to disclose it. There are generally two options for sharing/transferring the private data:
Org2 client application can send a query request to an Org1 peer. Org1’s chaincode would check if the client is authorized to query the data (perhaps using a combination of the client identity information, passed arguments, and the specific state information). If authorized, Org1 chaincode can choose to return data to Org2 client (and potentially endorse a ledger update). Note, this is where
memberOnlyReadcomes in... if it istruethe request will automatically return an error. If it isfalsethen you can use custom logic in the chaincode to determine if the client is authorized.Org1 could provide Org2 the private data out of band in another application. Org2 can then query their own Org2 peer and using GetPrivateDataHash() can confirm that a hash of the private data matches the on-chain hash. For example, if transferring an asset from Org1 to Org2 you may do this to confirm an asset on the ledger prior to the actual transfer.
@denyeart I noticed that this issue has not been addressed yet. Are there any plans to work on this issue in the near future? If it's alright with you, I would be more than happy to assist in resolving this issue. Please let me know if you could use my help.
@satota2 You are more than welcome to improve the message, thank you!
@denyeart Thank you! I'll consider some improvements.