我正在尝试将一个新的组织添加到Fabric测试网络(v2.2(中。我在add-org-org5/docker文件夹中创建了一个configtx.yaml文件(来源:https://gist.github.com/RafaelAPB/d55916b4b7151027ee3349b867e9fbdc):
Organizations:
- &org5
Name: org5MSP
ID: org5MSP
MSPDir: ../organizations/peerOrganizations/org5MSP.example.com/msp
Policies:
Readers:
Type: Signature
Rule: "OR('org5MSP.admin','org5MSP.peer','org5MSP.client')"
Writers:
Type: Signature
Rule:
- "OR('org5MSP.admin','org5MSP.client')"
Admins:
Type: Signature
Rule:
- "OR('org5MSP.admin')"
Endorsement:
Type: Signature
Rule:
- "OR('org5MSP.peer')"
当运行configtxgen -printOrg org5MSP -configPath /add-org-org5/docker
时,我获得以下(完整日志:https://gist.github.com/RafaelAPB/8144665eda4f91229f32d1b1f42058f2):
'x1B[35m2021-05-21 16:05:03.341 UTC [common.tools.configtxgen] func1 -> PANI 012x1B[0m failed to load configCache: Error unmarshaling config into struct: 3 error(s) decoding:rn' +
'rn' +
"* 'Organizations[0].Policies[Admins].Rule' expected type 'string', got unconvertible type '[]interface {}'rn" +
"* 'Organizations[0].Policies[Endorsement].Rule' expected type 'string', got unconvertible type '[]interface {}'rn" +
"* 'Organizations[0].Policies[Writers].Rule' expected type 'string', got unconvertible type '[]interface {}'rn" +
'panic: failed to load configCache: Error unmarshaling config into struct: 3 error(s) decoding:rn' +
'rn' +
看起来cryptogen没有识别出";规则";字符串。为什么?有什么建议吗?
默认的configtx.yaml文件(来源:https://gist.github.com/RafaelAPB/a1d9269d94f8f4f4d87b60d54c7b2247):
Organizations:
- &Org3
# DefaultOrg defines the organization which is used in the sampleconfig
# of the fabric.git development environment
Name: Org3MSP
# ID to load the MSP definition as
ID: Org3MSP
MSPDir: ../organizations/peerOrganizations/org3.example.com/msp
Policies:
Readers:
Type: Signature
Rule: "OR('Org3MSP.admin', 'Org3MSP.peer', 'Org3MSP.client')"
Writers:
Type: Signature
Rule: "OR('Org3MSP.admin', 'Org3MSP.client')"
Admins:
Type: Signature
Rule: "OR('Org3MSP.admin')"
Endorsement:
Type: Signature
Rule: "OR('Org3MSP.peer')"
提前感谢!
我认为您应该将您的org5 configtx.yaml修改为这些,您可以发现字段Rule
不同。
Organizations:
- &org5
Name: org5MSP
ID: org5MSP
MSPDir: ../organizations/peerOrganizations/org5MSP.example.com/msp
Policies:
Readers:
Type: Signature
Rule: "OR('org5MSP.admin','org5MSP.peer','org5MSP.client')"
Writers:
Type: Signature
Rule: "OR('org5MSP.admin','org5MSP.client')"
Admins:
Type: Signature
Rule: "OR('org5MSP.admin')"
Endorsement:
Type: Signature
Rule: "OR('org5MSP.peer')"