我试图在实例化我的链码后执行以下语句:
response, err := client.Query(channel.Request{
ChaincodeID: heligo.fsConfig.ChainCodeID,
Fcn: "invoke",
Args: defaultQueryArgs},
channel.WithRetry(retry.DefaultChannelOpts),
)
但是我收到以下调试日志错误:
[fabsdk/fab] 2019/03/06 13:09:55 UTC - fab.(*EndpointConfig).PeerConfig -> DEBU Found MatchingPeerConfig for name/url [peer1.org1.example.com:7051]
[fabsdk/client] 2019/03/06 13:09:55 UTC - options.(*Params).SetPeerFilter -> DEBU PeerFilter: (options.PeerFilter)(0x8ffd50)
[fabsdk/util] 2019/03/06 13:09:55 UTC - lazyref.(*Reference).setTimerRunning -> DEBU Timer started
[fabsdk/util] 2019/03/06 13:09:55 UTC - lazyref.checkTimeStarted -> DEBU Starting timer
[fabsdk/client] 2019/03/06 13:09:55 UTC - fabricselection.(*selectionFilter).Exclude -> DEBU Calling peer filter on endpoint [peer0.org2.example.com:7051]
[fabsdk/client] 2019/03/06 13:09:55 UTC - fabricselection.(*selectionFilter).Exclude -> DEBU Excluding peer [peer0.org2.example.com:7051] since it isn't in the set of peers returned by the discovery service
[fabsdk/common] 2019/03/06 13:09:55 UTC - retry.(*RetryableInvoker).Invoke -> DEBU Failed with err [Failed to get endorsing peers: error getting endorsers from channel response: no endorsement combination can be satisfied] on attempt #1. Checking if retry is warranted...
[fabsdk/common] 2019/03/06 13:09:55 UTC - retry.(*RetryableInvoker).Invoke -> DEBU ... retry for err [Failed to get endorsing peers: error getting endorsers from channel response: no endorsement combination can be satisfied] is NOT warranted after %!d(MISSING) attempt(s).
Failed to make client query: Failed to get endorsing peers: error getting endorsers from channel response: no endorsement combination can be satisfied
我无法弄清楚为什么我的同伴被排除在外,我正在修改BYFN示例项目并添加自己的链码。
我的认可政策是:
-P "AND ('Org1MSP.peer','Org2MSP.peer')"
我的配置文件是:
name: "byfn"
version: 1.0.0
client:
organization: org1
logging:
level: debug
cryptoconfig:
path: ../../crypto-config/
credentialStore:
path: "/tmp/state-store"
cryptoStore:
path: "/tmp/crypto-store"
BCCSP:
security:
enabled: true
default:
provider: "SW"
hashAlgorithm: "SHA2"
softVerify: true
level: 256
tlsCerts:
client:
keyfile:
certfile:
channels:
heligo-channel:
peers:
peer0.org1.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true
peer1.org1.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true
peer0.org2.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true
peer1.org2.example.com:
endorsingPeer: true
chaincodeQuery: true
ledgerQuery: true
eventSource: true
policies:
queryChannelConfig:
minResponses: 1
maxTargets: 1
retryOpts:
attempts: 5
initialBackoff: 500ms
maxBackoff: 5s
backoffFactor: 2.0
organizations:
org1:
mspid: Org1MSP
cryptoPath: ../../crypto-config/peerOrganizations/org1.example.com/users/{username}@org1.example.com/msp
users:
Admin:
cert:
path: ../../crypto-config/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem
User1:
cert:
path: ../../crypto-config/peerOrganizations/org1.example.com/users/User1@org1.example.com/msp/signcerts/User1@org1.example.com-cert.pem
peers:
- peer0.org1.example.com
- peer1.org1.example.com
certificateAuthorities:
- ca_peerOrg1
org2:
mspid: Org2MSP
cryptoPath: ../../crypto-config/peerOrganizations/org2.example.com/users/{username}@org2.example.com/msp
users:
Admin:
cert:
path: ../../crypto-config/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/signcerts/Admin@org2.example.com-cert.pem
User1:
cert:
path: ../../crypto-config/peerOrganizations/org2.example.com/users/User1@org2.example.com/msp/signcerts/User1@org2.example.com-cert.pem
peers:
- peer0.org2.example.com
- peer1.org2.example.com
certificateAuthorities:
- ca_peerOrg2
orderers:
orderer.example.com:
url: localhost:7050
grpcOptions:
ssl-target-name-override: orderer.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: ../../crypto-config/ordererOrganizations/example.com/tlsca/tlsca.example.com-cert.pem
peers:
peer0.org1.example.com:
url: localhost:7051
eventUrl: localhost:7053
grpcOptions:
ssl-target-name-override: peer0.org1.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: ../../crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem
peer1.org1.example.com:
url: localhost:8051
eventUrl: localhost:8053
grpcOptions:
ssl-target-name-override: peer1.org1.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: ../../crypto-config/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem
peer0.org2.example.com:
url: localhost:9051
eventUrl: localhost:9053
grpcOptions:
ssl-target-name-override: peer0.org2.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: ../../crypto-config/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem
peer1.org2.example.com:
url: localhost:10051
eventUrl: localhost:10053
grpcOptions:
ssl-target-name-override: peer1.org2.example.com
keep-alive-time: 0s
keep-alive-timeout: 20s
keep-alive-permit: false
fail-fast: false
allow-insecure: false
tlsCACerts:
path: ../../crypto-config/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem
certificateAuthorities:
ca_peerOrg1:
url: http://localhost:7054
httpOptions:
verify: false
registrar:
enrollId: admin
enrollSecret: adminpw
caName: ca_peerOrg1
tlsCACerts:
path: ../../crypto-config/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem
ca_peerOrg2:
url: http://localhost:7064
httpOptions:
verify: false
registrar:
enrollId: admin
enrollSecret: adminpw
caName: ca_peerOrg2
tlsCACerts:
path: ../../crypto-config/peerOrganizations/org2.example.com/ca/ca.org2.example.com-cert.pem
entityMatchers:
peer:
- pattern: (\w*)peer0.org1.example.com(\w*)
urlSubstitutionExp: localhost:7051
eventUrlSubstitutionExp: localhost:7053
sslTargetOverrideUrlSubstitutionExp: peer0.org1.example.com
mappedHost: peer0.org1.example.com
- pattern: (\w*)peer1.org1.example.com(\w*)
urlSubstitutionExp: localhost:8051
eventUrlSubstitutionExp: localhost:8053
sslTargetOverrideUrlSubstitutionExp: peer1.org1.example.com
mappedHost: peer1.org1.example.com
- pattern: (\w*)peer0.org2.example.com(\w*)
urlSubstitutionExp: localhost:9051
eventUrlSubstitutionExp: localhost:9053
sslTargetOverrideUrlSubstitutionExp: peer0.org2.example.com
mappedHost: peer0.org2.example.com
- pattern: (\w*)peer1.org2.example.com(\w*)
urlSubstitutionExp: localhost:10051
eventUrlSubstitutionExp: localhost:10053
sslTargetOverrideUrlSubstitutionExp: peer1.org2.example.com
mappedHost: peer1.org2.example.com
orderer:
- pattern: (\w*)orderer.example.com(\w*)
urlSubstitutionExp: localhost:7050
sslTargetOverrideUrlSubstitutionExp: orderer.example.com
mappedHost: orderer.example.com
certificateAuthorities:
- pattern: (\w*)ca_peerOrg1(\w*)
urlSubstitutionExp: localhost:7054
mappedHost: ca_peerOrg1
- pattern: (\w*)ca_peerOrg2(\w*)
urlSubstitutionExp: localhost:7064
mappedHost: ca_peerOrg2
我确实尽力去解决这个问题,但是由于文档不够深入,我还是没办法。任何帮助是极大的赞赏!!
答案 0 :(得分:1)
问题是实体匹配器部分中的urlSubstitutionExp和eventUrlSubstitutionExp的值错误。值应该是对等名称,而不是localhost。