Hyperledger Fabric configtxgen - 读取配置时出错:地图合并需要地图或地图序列作为值

Hyperledger Fabric configtxgen - Error reading config: map merge requires map or sequence of maps as the value

我正在尝试使用以下内容设置一个简单的 Fabric 网络:

使用 cryptogen 工具生成所有必需的文件后,运行 configtxgen 命令出现以下错误:

student@abc:~/Desktop/fabric/network$ configtxgen -profile DefaultBlockOrderingService -outputBlock ./config/genesis.block -configPath $PWD
    2019-12-26 12:35:42.131 MST [common.tools.configtxgen] main -> WARN 001 Omitting the channel ID for configtxgen for output operations is deprecated.  Explicitly passing the channel ID will be required in the future, defaulting to 'testchainid'.
    2019-12-26 12:35:42.136 MST [common.tools.configtxgen] main -> INFO 002 Loading configuration
    2019-12-26 12:35:42.137 MST [common.tools.configtxgen.localconfig] Load -> PANI 003 Error reading configuration:  While parsing config: yaml: map merge requires map or sequence of maps as the value
    2019-12-26 12:35:42.137 MST [common.tools.configtxgen] func1 -> PANI 004 Error reading configuration:  While parsing config: yaml: map merge requires map or sequence of maps as the value
    panic: Error reading configuration:  While parsing config: yaml: map merge requires map or sequence of maps as the value [recovered]
        panic: Error reading configuration:  While parsing config: yaml: map merge requires map or sequence of maps as the value

这是configtx.yaml

Organizations:
    - &abccoinOrderers
        Name: abccoinOrderersMSP
        ID: abccoinOrderersMSP
        MSPDir: crypto-config/ordererOrganizations/abccoin.com/msp
    - &ABC
        Name: ABCMSP
        ID: ABCMSP
        MSPDir: crypto-config/peerOrganizations/ABC.abccoin.com/msp
        AnchorPeers:
          - Host: Andy.ABC.abccoin.com
            Port: 7051

Application: &ApplicationDefaults

Orderer:
    - &DevModeOrdering
        OrdererType: solo
        Addresses:  
            - Devorderer.abccoin.com:7050
        BatchTimeout: 2s
        BatchSize:
            MaxMessageCount: 1

Profiles:
    DefaultBlockOrderingService:
        Orderer:
            <<: *DevModeOrdering
            Organizations:
                - *abccoinOrderers
        Consortiums:
            SampleConsortium:
                Organizations:
                    - *ABC


    abcMembersOnly:
        Consortium: SampleConsortium
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *ABC

我已经尝试按照 . I've also tried pacing the "<<" key in quotes as mentioned in this issue YML document "<<: value" cannot be parsed #245 中所述重新排列代码块,但没有帮助。

configtx.yaml 中有 2 个错误。

  1. Orderer:是map类型或者object类型,不是array或者slice类型。当您使用 - 定义参数时,它在 yaml 中用作数组。
Orderer:
    // remove -
    &DevModeOrdering
      OrdererType: solo
      Addresses:  
          - Devorderer.abccoin.com:7050
      BatchTimeout: 2s
      BatchSize:
          MaxMessageCount: 1
  1. Application: 您必须声明 Organizations: 参数。它可以是空的。如果你不声明任何东西,它就不会编译。要检查,您应该尝试在任何在线转换器中将 yaml 转换为 json。
Application: &ApplicationDefaults
    Organizations: