我想在结构中获取查询结果时遇到麻烦。我有2个频道,频道1存储了帐户数据,频道2存储了一些内容及其费用。我在频道1中,我想在频道2中查询内容的费用,然后在频道1中“购买”它。例如,频道1有一个帐户A,他有20美元,频道2的电影费用为9美元,A要查询电影的成本,然后“购买”,所以A现在只有11美元。但是现在我不知道如何从channel2获取“ $ 9”。我该怎么做?
答案 0 :(得分:0)
Fabric使用通道作为隔离形式。 如何使用“ InvokeChaincode” API调用另一个链码。
// InvokeChaincode locally calls the specified chaincode `Invoke` using the
// same transaction context; that is, chaincode calling chaincode doesn't
// create a new transaction message.
// If the called chaincode is on the same channel, it simply adds the called
// chaincode read set and write set to the calling transaction.
// If the called chaincode is on a different channel,
// only the Response is returned to the calling chaincode; any PutState calls
// from the called chaincode will not have any effect on the ledger; that is,
// the called chaincode on a different channel will not have its read set
// and write set applied to the transaction. Only the calling chaincode's
// read set and write set will be applied to the transaction. Effectively
// the called chaincode on a different channel is a `Query`, which does not
// participate in state validation checks in subsequent commit phase.
// If `channel` is empty, the caller's channel is assumed.
InvokeChaincode(chaincodeName string, args [][]byte, channel string) pb.Response