From 7a0f5b7b71a4d99e077e2541fe6c991c4162f382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9A=BE=E6=9A=BE?= <631078133@qq.com> Date: Fri, 28 Aug 2020 03:21:10 +0800 Subject: [PATCH] =?UTF-8?q?Fixed=20script=20bugs=20"SendTransaction=20fail?= =?UTF-8?q?ed:=20orderers=20is=20nil".=20Signed-off-by:=20=E6=9A=BE?= =?UTF-8?q?=E6=9A=BE=20<631078133@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test-network/organizations/ccp-generate.sh | 33 +++++++++++++------- test-network/organizations/ccp-template.json | 26 +++++++++++++++ test-network/organizations/ccp-template.yaml | 22 +++++++++++++ 3 files changed, 69 insertions(+), 12 deletions(-) diff --git a/test-network/organizations/ccp-generate.sh b/test-network/organizations/ccp-generate.sh index 7e091d0b..ebd3797b 100755 --- a/test-network/organizations/ccp-generate.sh +++ b/test-network/organizations/ccp-generate.sh @@ -5,35 +5,44 @@ function one_line_pem { } function json_ccp { - local PP=$(one_line_pem $4) - local CP=$(one_line_pem $5) + local OP=$(one_line_pem $5) + local PP=$(one_line_pem $6) + local CP=$(one_line_pem $7) sed -e "s/\${ORG}/$1/" \ - -e "s/\${P0PORT}/$2/" \ - -e "s/\${CAPORT}/$3/" \ + -e "s/\${ORDERERPORT}/$2/" \ + -e "s/\${P0PORT}/$3/" \ + -e "s/\${CAPORT}/$4/" \ + -e "s#\${ORDERERPEM}#$OP#" \ -e "s#\${PEERPEM}#$PP#" \ -e "s#\${CAPEM}#$CP#" \ organizations/ccp-template.json } function yaml_ccp { - local PP=$(one_line_pem $4) - local CP=$(one_line_pem $5) + local OP=$(one_line_pem $5) + local PP=$(one_line_pem $6) + local CP=$(one_line_pem $7) sed -e "s/\${ORG}/$1/" \ - -e "s/\${P0PORT}/$2/" \ - -e "s/\${CAPORT}/$3/" \ + -e "s/\${ORDERERPORT}/$2/" \ + -e "s/\${P0PORT}/$3/" \ + -e "s/\${CAPORT}/$4/" \ + -e "s#\${ORDERERPEM}#$OP#" \ -e "s#\${PEERPEM}#$PP#" \ -e "s#\${CAPEM}#$CP#" \ organizations/ccp-template.yaml | sed -e $'s/\\\\n/\\\n /g' } +ORDERERPORT=7050 +ORDERERPEM=organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem + ORG=1 P0PORT=7051 CAPORT=7054 PEERPEM=organizations/peerOrganizations/org1.example.com/tlsca/tlsca.org1.example.com-cert.pem CAPEM=organizations/peerOrganizations/org1.example.com/ca/ca.org1.example.com-cert.pem -echo "$(json_ccp $ORG $P0PORT $CAPORT $PEERPEM $CAPEM)" > organizations/peerOrganizations/org1.example.com/connection-org1.json -echo "$(yaml_ccp $ORG $P0PORT $CAPORT $PEERPEM $CAPEM)" > organizations/peerOrganizations/org1.example.com/connection-org1.yaml +echo "$(json_ccp $ORG $ORDERERPORT $P0PORT $CAPORT $ORDERERPEM $PEERPEM $CAPEM)" > organizations/peerOrganizations/org1.example.com/connection-org1.json +echo "$(yaml_ccp $ORG $ORDERERPORT $P0PORT $CAPORT $ORDERERPEM $PEERPEM $CAPEM)" > organizations/peerOrganizations/org1.example.com/connection-org1.yaml ORG=2 P0PORT=9051 @@ -41,5 +50,5 @@ CAPORT=8054 PEERPEM=organizations/peerOrganizations/org2.example.com/tlsca/tlsca.org2.example.com-cert.pem CAPEM=organizations/peerOrganizations/org2.example.com/ca/ca.org2.example.com-cert.pem -echo "$(json_ccp $ORG $P0PORT $CAPORT $PEERPEM $CAPEM)" > organizations/peerOrganizations/org2.example.com/connection-org2.json -echo "$(yaml_ccp $ORG $P0PORT $CAPORT $PEERPEM $CAPEM)" > organizations/peerOrganizations/org2.example.com/connection-org2.yaml +echo "$(json_ccp $ORG $ORDERERPORT $P0PORT $CAPORT $ORDERERPEM $PEERPEM $CAPEM)" > organizations/peerOrganizations/org2.example.com/connection-org2.json +echo "$(yaml_ccp $ORG $ORDERERPORT $P0PORT $CAPORT $ORDERERPEM $PEERPEM $CAPEM)" > organizations/peerOrganizations/org2.example.com/connection-org2.yaml diff --git a/test-network/organizations/ccp-template.json b/test-network/organizations/ccp-template.json index e945bfe9..618ce22e 100755 --- a/test-network/organizations/ccp-template.json +++ b/test-network/organizations/ccp-template.json @@ -45,5 +45,31 @@ "verify": false } } + }, + "channels": { + "mychannel": { + "orderers": ["orderer.example.com"], + "peers": { + "peer0.org${ORG}.example.com": { + "endorsingPeer": true, + "chaincodeQuery": true, + "ledgerQuery": true, + "eventSource": true, + "discover": true + } + } + } + }, + "orderers": { + "orderer.example.com": { + "url": "grpcs://localhost:${ORDERERPORT}", + "tlsCACerts": { + "pem": "${ORDERERPEM}" + }, + "grpcOptions": { + "ssl-target-name-override": "orderer.example.com", + "hostnameOverride": "orderer.example.com" + } + } } } diff --git a/test-network/organizations/ccp-template.yaml b/test-network/organizations/ccp-template.yaml index b675c186..25baf5ef 100755 --- a/test-network/organizations/ccp-template.yaml +++ b/test-network/organizations/ccp-template.yaml @@ -33,3 +33,25 @@ certificateAuthorities: ${CAPEM} httpOptions: verify: false +channels: + mychannel: + orderers: + - orderer.example.com + peers: + peer0.org${ORG}.example.com: + endorsingPeer: true + chaincodeQuery: true + ledgerQuery: true + eventSource: true + discover: true + +orderers: + orderer.example.com: + url: grpcs://localhost:${ORDERERPORT} + tlsCACerts: + pem: | + ${ORDERERPEM} + grpcOptions: + ssl-target-name-override: orderer.example.com + hostnameOverride: orderer.example.com +