大家好,我正在尝试使用节点 js 客户端的服务发现来生成交易提案,我遇到的问题是,当发现生成背书计划时,它会将提案发送给同一个对等方并且无法背书,这是其中之一生成了背书计划,不知道为什么,但是同行的名字都是错误的
{
"chaincode": "auditoria-cc",
"groups": {
"G0": {
"peers": [
{
"mspid": "Org1MSP",
"endpoint": "peer0.org1.autentia-bchain.com:7051",
"ledger_height": {
"low": 11,
"high": 0,
"unsigned": true
},
"chaincodes": [
{
"name": "auditoria-cc",
"version": "1.0"
}
],
"name": "peer0.org1.autentia-bchain.com"
}
]
},
"G1": {
"peers": [
{
"mspid": "Org2MSP",
"endpoint": "peer0.org2.autentia-bchain.com:7051",
"ledger_height": {
"low": 11,
"high": 0,
"unsigned": true
},
"chaincodes": [
{
"name": "auditoria-cc",
"version": "1.0"
}
],
"name": "peer0.org1.autentia-bchain.com"
}
]
},
"G2": {
"peers": [
{
"mspid": "Org3MSP",
"endpoint": "peer0.org3.autentia-bchain.com:7051",
"ledger_height": {
"low": 11,
"high": 0,
"unsigned": true
},
"chaincodes": [
{
"name": "auditoria-cc",
"version": "1.0"
}
],
"name": "peer0.org1.autentia-bchain.com"
}
]
},
"G3": {
"peers": [
{
"mspid": "Org4MSP",
"endpoint": "peer0.org4.autentia-bchain.com:7051",
"ledger_height": {
"low": 11,
"high": 0,
"unsigned": true
},
"chaincodes": [
{
"name": "auditoria-cc",
"version": "1.0"
}
],
"name": "peer0.org1.autentia-bchain.com"
}
]
}
},
"layouts": [
{
"G1": 1,
"G2": 1,
"G0": 1
},
{
"G3": 1,
"G0": 1,
"G1": 1
},
{
"G2": 1,
"G3": 1,
"G0": 1
},
{
"G2": 1,
"G3": 1,
"G1": 1
}
],
"plan_id": "{\"chaincodes\":[{\"name\":\"auditoria-cc\"}]}",
"endorsements": {
}
}
这是发送提案时的日志
[2019-05-13 12:39:39.894] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _endorse - starting layout plan 0
[2019-05-13 12:39:39.895] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _endorse_layout - start
[2019-05-13 12:39:39.895] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G2:0 - start
[2019-05-13 12:39:39.895] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G2:0 - send endorsement to peer0.org1.autentia-bchain.com
[2019-05-13 12:39:39.895] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G3:1 - start
[2019-05-13 12:39:39.895] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G3:1 - send endorsement to peer0.org1.autentia-bchain.com
[2019-05-13 12:39:39.895] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G0:2 - start
[2019-05-13 12:39:39.896] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G0:2 - send endorsement to peer0.org1.autentia-bchain.com
[2019-05-13 12:39:39.902] [WARN] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G0:2 - endorsement failed - Error: failed to execute transaction fe2fb28959f06b693e5b834ecfe5fab3aabe8e393f4cc1b2376db7b5aed9f096: error sending: txid: fe2fb28959f06b693e5b834ecfe5fab3aabe8e393f4cc1b2376db7b5aed9f096(auditoria-channel) exists
[2019-05-13 12:39:39.902] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G0:2 - not able to get a completed endorsement
[2019-05-13 12:39:39.902] [WARN] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G3:1 - endorsement failed - Error: failed to execute transaction fe2fb28959f06b693e5b834ecfe5fab3aabe8e393f4cc1b2376db7b5aed9f096: error sending: txid: fe2fb28959f06b693e5b834ecfe5fab3aabe8e393f4cc1b2376db7b5aed9f096(auditoria-channel) exists
[2019-05-13 12:39:39.902] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G3:1 - not able to get a completed endorsement
[2019-05-13 12:39:39.965] [DEBUG] Helper - [DiscoveryEndorsementHandler]: _build_endorse_group_member >> G2:0 - endorsement completed to peer0.org1.autentia-bchain.com - 200
编辑 1:初始化日志
[2019-05-13 17:31:18.543] [DEBUG] Helper - getClientForOrg - ****** END Org1 test1
[2019-05-13 17:31:18.544] [DEBUG] invoke-chaincode - Successfully got the fabric client for the organization "Org1"
[2019-05-13 17:31:18.544] [DEBUG] Helper - [NetworkConfig101.js]: getChannel - name auditoria-channel
[2019-05-13 17:31:18.544] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org1.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.546] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org1
[2019-05-13 17:31:18.546] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.546] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org1.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.547] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org1.autentia-bchain.com
[2019-05-13 17:31:18.547] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.547] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org1
[2019-05-13 17:31:18.547] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.547] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org1.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.547] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org1.autentia-bchain.com
[2019-05-13 17:31:18.547] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.547] [DEBUG] Helper - [NetworkConfig101.js]: _addPeersToChannel - peer0.org1.autentia-bchain.com - grpcs://localhost:7051
[2019-05-13 17:31:18.547] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org2.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.548] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org1
[2019-05-13 17:31:18.548] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.548] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org1.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.548] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org1.autentia-bchain.com
[2019-05-13 17:31:18.548] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.548] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org2
[2019-05-13 17:31:18.548] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.548] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org2.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.548] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org2.autentia-bchain.com
[2019-05-13 17:31:18.549] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.549] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org2
[2019-05-13 17:31:18.549] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.549] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org2.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.549] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org2.autentia-bchain.com
[2019-05-13 17:31:18.549] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.549] [DEBUG] Helper - [NetworkConfig101.js]: _addPeersToChannel - peer0.org2.autentia-bchain.com - grpcs://localhost:8051
[2019-05-13 17:31:18.550] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org3.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.553] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org1
[2019-05-13 17:31:18.553] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.554] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org1.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.554] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org1.autentia-bchain.com
[2019-05-13 17:31:18.554] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.555] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org2
[2019-05-13 17:31:18.555] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.555] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org2.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.555] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org2.autentia-bchain.com
[2019-05-13 17:31:18.555] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.555] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org3
[2019-05-13 17:31:18.555] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.555] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org3.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.556] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org3.autentia-bchain.com
[2019-05-13 17:31:18.556] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.556] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org3
[2019-05-13 17:31:18.556] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.556] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org3.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.556] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org3.autentia-bchain.com
[2019-05-13 17:31:18.556] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.556] [DEBUG] Helper - [NetworkConfig101.js]: _addPeersToChannel - peer0.org3.autentia-bchain.com - grpcs://localhost:9051
[2019-05-13 17:31:18.556] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org4.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.557] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org1
[2019-05-13 17:31:18.557] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.557] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org1.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.557] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org1.autentia-bchain.com
[2019-05-13 17:31:18.558] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.558] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org2
[2019-05-13 17:31:18.559] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.559] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org2.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.559] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org2.autentia-bchain.com
[2019-05-13 17:31:18.559] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.559] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org3
[2019-05-13 17:31:18.559] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.559] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org3.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.559] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org3.autentia-bchain.com
[2019-05-13 17:31:18.559] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.560] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org4
[2019-05-13 17:31:18.560] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.560] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org4.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.560] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org4.autentia-bchain.com
[2019-05-13 17:31:18.560] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.560] [DEBUG] Helper - [NetworkConfig101.js]: getOrganization - name Org4
[2019-05-13 17:31:18.560] [DEBUG] Helper - [Organization.js]: Organization.const
[2019-05-13 17:31:18.560] [DEBUG] Helper - [NetworkConfig101.js]: getPeer - name peer0.org4.autentia-bchain.com, channel_org: undefined
[2019-05-13 17:31:18.560] [DEBUG] Helper - [NetworkConfig101.js]: getCertificateAuthority - name ca.org4.autentia-bchain.com
[2019-05-13 17:31:18.560] [DEBUG] Helper - [CertificateAuthority.js]: CertificateAuthority.const
[2019-05-13 17:31:18.561] [DEBUG] Helper - [NetworkConfig101.js]: _addPeersToChannel - peer0.org4.autentia-bchain.com - grpcs://localhost:10051
[2019-05-13 17:31:18.561] [DEBUG] Helper - [NetworkConfig101.js]: getOrderer - name orderer.autentia-bchain.com
[2019-05-13 17:31:18.563] [DEBUG] Helper - [DiscoveryEndorsementHandler]: initialize -
当我执行 channel.getChannelPeers() 时,我会得到一个包含同行的列表,其中包含正确的名称。
[ ChannelPeer {
_mspid: 'Org1MSP',
_channel:
Channel {
_name: 'auditoria-channel',
_channel_peers: [Object],
_anchor_peers: [],
_orderers: [Object],
_kafka_brokers: [],
_clientContext: [Object],
_msp_manager: [Object],
_discovery_interests: [Object],
_discovery_results: [Object],
_last_discover_timestamp: 1557779840912,
_use_discovery: true,
_as_localhost: true,
_endorsement_handler: [Object],
_commit_handler: [Object],
_last_refresh_request: [Object] },
_name: 'peer0.org1.autentia-bchain.com',
_peer:
Peer {
_options: [Object],
clientCert: undefined,
_url: 'grpcs://localhost:7051',
_endpoint: [Object],
_name: 'peer0.org1.autentia-bchain.com',
_request_timeout: 45000,
_grpc_wait_for_ready_timeout: 3000,
_endorserClient: [Object],
_discoveryClient: [Object] },
_roles:
{ endorsingPeer: true,
chaincodeQuery: true,
ledgerQuery: true,
eventSource: true } },
ChannelPeer {
_mspid: 'Org2MSP',
_channel:
Channel {
_name: 'auditoria-channel',
_channel_peers: [Object],
_anchor_peers: [],
_orderers: [Object],
_kafka_brokers: [],
_clientContext: [Object],
_msp_manager: [Object],
_discovery_interests: [Object],
_discovery_results: [Object],
_last_discover_timestamp: 1557779840912,
_use_discovery: true,
_as_localhost: true,
_endorsement_handler: [Object],
_commit_handler: [Object],
_last_refresh_request: [Object] },
_name: 'peer0.org2.autentia-bchain.com',
_peer:
Peer {
_options: [Object],
clientCert: undefined,
_url: 'grpcs://localhost:8051',
_endpoint: [Object],
_name: 'peer0.org2.autentia-bchain.com',
_request_timeout: 45000,
_grpc_wait_for_ready_timeout: 3000,
_endorserClient: [Object],
_discoveryClient: [Object] },
_roles:
{ endorsingPeer: true,
chaincodeQuery: true,
ledgerQuery: true,
eventSource: true } },
ChannelPeer {
_mspid: 'Org3MSP',
_channel:
Channel {
_name: 'auditoria-channel',
_channel_peers: [Object],
_anchor_peers: [],
_orderers: [Object],
_kafka_brokers: [],
_clientContext: [Object],
_msp_manager: [Object],
_discovery_interests: [Object],
_discovery_results: [Object],
_last_discover_timestamp: 1557779840912,
_use_discovery: true,
_as_localhost: true,
_endorsement_handler: [Object],
_commit_handler: [Object],
_last_refresh_request: [Object] },
_name: 'peer0.org3.autentia-bchain.com',
_peer:
Peer {
_options: [Object],
clientCert: undefined,
_url: 'grpcs://localhost:9051',
_endpoint: [Object],
_name: 'peer0.org3.autentia-bchain.com',
_request_timeout: 45000,
_grpc_wait_for_ready_timeout: 3000,
_endorserClient: [Object],
_discoveryClient: [Object] },
_roles:
{ endorsingPeer: true,
chaincodeQuery: true,
ledgerQuery: true,
eventSource: true } },
ChannelPeer {
_mspid: 'Org4MSP',
_channel:
Channel {
_name: 'auditoria-channel',
_channel_peers: [Object],
_anchor_peers: [],
_orderers: [Object],
_kafka_brokers: [],
_clientContext: [Object],
_msp_manager: [Object],
_discovery_interests: [Object],
_discovery_results: [Object],
_last_discover_timestamp: 1557779840912,
_use_discovery: true,
_as_localhost: true,
_endorsement_handler: [Object],
_commit_handler: [Object],
_last_refresh_request: [Object] },
_name: 'peer0.org4.autentia-bchain.com',
_peer:
Peer {
_options: [Object],
clientCert: undefined,
_url: 'grpcs://localhost:10051',
_endpoint: [Object],
_name: 'peer0.org4.autentia-bchain.com',
_request_timeout: 45000,
_grpc_wait_for_ready_timeout: 3000,
_endorserClient: [Object],
_discoveryClient: [Object] },
_roles: