[英]Dynamically assign endorsing or chaincode query role to channel peers in the Fabric Node SDK
I am using the following Fabric Versions:我正在使用以下 Fabric 版本:
I wish to perform query
operation on the channel using Fabric Node SDK, preferably using the "fabric-network" components.我希望使用 Fabric Node SDK 在通道上执行
query
操作,最好使用“fabric-network”组件。 I have only 1 peer as the endorsing peer (one that has chaincode installed on it) out of 3 peers in total on the channel for that peer organization.在该对等组织的通道上总共有 3 个对等点中,我只有 1 个对等点作为背书对等点(一个安装了链代码的对等点)。 NOTE: I do not have the roles assigned to these peers in the "connection-profile" explicitly and I am using "discovery" to be enabled on the channel.
注意:我没有在“连接配置文件”中明确分配给这些对等方的角色,并且我正在使用“发现”在通道上启用。
I assumed that the SDK function setEndorsingPeers
from the transaction.js
module will allow me to dynamically assign role to the peers based upon user input.我假设
transaction.js
模块中的 SDK function setEndorsingPeers
将允许我根据用户输入动态分配角色给对等方。 But when I deep-dived into the Fabric Node SDK code, I saw that, the evaluate
function in the transaction.js
calls the default query handler, which sends the proposal randomly to one of the peers using MSPID_SCOPE_SINGLE phenomenon.但是当我深入研究 Fabric 节点 SDK 代码时,我看到,
transaction.js
中的evaluate
function 调用了默认查询处理程序,该处理程序使用 MSPID_SCOPE_SINGLE 现象将提案随机发送到其中一个节点。
But because the discovery is enabled, the request may go to dynamically a committing peer, and returns failure.但是由于启用了发现,请求可能 go 动态地提交给对等体,并返回失败。 I know one possible solution is to use my custom query handler.
我知道一种可能的解决方案是使用我的自定义查询处理程序。 But I wish to identify, if dynamically I can assign
endorsingPeer
or chaincodeQuery
role to channel peers in the Fabric Node SDK (v1.4.9)?但我想确定,如果我可以动态地将
endorsingPeer
或chaincodeQuery
角色分配给 Fabric 节点 SDK (v1.4.9) 中的通道对等点?
Have you ever used 'javascript-low-level'?你用过'javascript-low-level'吗? you can specify endorsing peer with
channel.addPeer()
function.您可以使用
channel.addPeer()
function 指定背书节点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.