紧急情况:运行时错误:索引超出范围使用genesis.block启动定购器时

时间:2019-07-10 10:55:16

标签: hyperledger-fabric hyperledger

当我尝试启动订购器时,索引超出范围。我发生在订购者的配置值之后:

        Operations.TLS.Enabled = false
        Operations.TLS.PrivateKey = ""
        Operations.TLS.Certificate = ""
        Operations.TLS.RootCAs = []
        Operations.TLS.ClientAuthRequired = false
        Operations.TLS.ClientRootCAs = []
        Metrics.Provider = "disabled"
        Metrics.Statsd.Network = "udp"
        Metrics.Statsd.Address = "127.0.0.1:8125"
        Metrics.Statsd.WriteInterval = 30s
        Metrics.Statsd.Prefix = ""
panic: runtime error: index out of range

goroutine 1 [running]:
github.com/hyperledger/fabric/msp.(*bccspmsp).sanitizeCert(0xc0002079e0, 0xc000111700, 0x26, 0xc000531108, 0x1)
        /opt/gopath/src/github.com/hyperledger/fabric/msp/mspimpl.go:691 +0x207
github.com/hyperledger/fabric/msp.newIdentity(0xc000111700, 0x1152560, 0xc00000ef98, 0xc0002079e0, 0xc00035e148, 0x1152560, 0xc00000ef98, 0x0)
        /opt/gopath/src/github.com/hyperledger/fabric/msp/identities.go:47 +0x70
github.com/hyperledger/fabric/msp.(*bccspmsp).getIdentityFromConf(0xc0002079e0, 0xc000354000, 0x3cd, 0x400, 0x1, 0x1, 0x0, 0x7c8088, 0xc0000ac7e0, 0xff)
        /opt/gopath/src/github.com/hyperledger/fabric/msp/mspimpl.go:161 +0x102
github.com/hyperledger/fabric/msp.(*bccspmsp).setupCAs(0xc0002079e0, 0xc00014b1d0, 0x0, 0x0)
        /opt/gopath/src/github.com/hyperledger/fabric/msp/mspimplsetup.go:134 +0x65d
github.com/hyperledger/fabric/msp.(*bccspmsp).preSetupV1(0xc0002079e0, 0xc00014b1d0, 0xc0005312f0, 0x7d23a0)
        /opt/gopath/src/github.com/hyperledger/fabric/msp/mspimplsetup.go:393 +0x64
github.com/hyperledger/fabric/msp.(*bccspmsp).setupV1(0xc0002079e0, 0xc00014b1d0, 0x1, 0x1)
        /opt/gopath/src/github.com/hyperledger/fabric/msp/mspimplsetup.go:373 +0x39
github.com/hyperledger/fabric/msp.(*bccspmsp).setupV1-fm(0xc00014b1d0, 0x1026ec0, 0x1a)
        /opt/gopath/src/github.com/hyperledger/fabric/msp/mspimpl.go:112 +0x34
github.com/hyperledger/fabric/msp.(*bccspmsp).Setup(0xc0002079e0, 0xc00034a300, 0x0, 0xc00034a3c0)
        /opt/gopath/src/github.com/hyperledger/fabric/msp/mspimpl.go:225 +0x14d
github.com/hyperledger/fabric/msp/cache.(*cachedMSP).Setup(0xc0004f2f90, 0xc00034a300, 0x1159600, 0xc0004f2f90)
        /opt/gopath/src/github.com/hyperledger/fabric/msp/cache/cache.go:88 +0x4b
github.com/hyperledger/fabric/common/channelconfig.(*MSPConfigHandler).ProposeMSP(0xc000508550, 0xc00034a300, 0x19, 0xc0005314c8, 0x1, 0x1)
        /opt/gopath/src/github.com/hyperledger/fabric/common/channelconfig/msp.go:68 +0xc0
github.com/hyperledger/fabric/common/channelconfig.(*OrganizationConfig).validateMSP(0xc00034a2c0, 0x0, 0xffffffffffffffff)
        /opt/gopath/src/github.com/hyperledger/fabric/common/channelconfig/organization.go:80 +0xc0
github.com/hyperledger/fabric/common/channelconfig.(*OrganizationConfig).Validate(0xc00034a2c0, 0xc000531550, 0x1)
        /opt/gopath/src/github.com/hyperledger/fabric/common/channelconfig/organization.go:73 +0x2b
github.com/hyperledger/fabric/common/channelconfig.NewOrganizationConfig(0xc0004fcf48, 0x6, 0xc0004f55e0, 0xc000508550, 0x0, 0x0, 0x8)
        /opt/gopath/src/github.com/hyperledger/fabric/common/channelconfig/organization.go:54 +0x10e
github.com/hyperledger/fabric/common/channelconfig.NewConsortiumConfig(0xc0004f5590, 0xc000508550, 0xc0005316c0, 0xf07a40, 0xc0004f2e70)
        /opt/gopath/src/github.com/hyperledger/fabric/common/channelconfig/consortium.go:44 +0x196
github.com/hyperledger/fabric/common/channelconfig.NewConsortiumsConfig(0xc0004f5540, 0xc000508550, 0xc000531808, 0x4, 0x1b8ac00)
        /opt/gopath/src/github.com/hyperledger/fabric/common/channelconfig/consortiums.go:31 +0x103
github.com/hyperledger/fabric/common/channelconfig.NewChannelConfig(0xc0004f5040, 0x0, 0x0, 0x0)
        /opt/gopath/src/github.com/hyperledger/fabric/common/channelconfig/channel.go:104 +0x392
github.com/hyperledger/fabric/common/channelconfig.NewBundle(0xc0004fd2e0, 0xc, 0xc0004f2780, 0xc000536510, 0x0, 0x0)
        /opt/gopath/src/github.com/hyperledger/fabric/common/channelconfig/bundle.go:196 +0x6b
github.com/hyperledger/fabric/common/channelconfig.NewBundleFromEnvelope(0xc0004f4a50, 0x1444, 0x1500, 0x114b520)
        /opt/gopath/src/github.com/hyperledger/fabric/common/channelconfig/bundle.go:187 +0x14d
github.com/hyperledger/fabric/orderer/common/server.ValidateBootstrapBlock(0xc000079940, 0xc000079940, 0xc000531be8)
        /opt/gopath/src/github.com/hyperledger/fabric/orderer/common/server/onboarding.go:349 +0xf7
github.com/hyperledger/fabric/orderer/common/server.Start(0x1013e09, 0x5, 0xc0004c8900)
        /opt/gopath/src/github.com/hyperledger/fabric/orderer/common/server/main.go:97 +0x59
github.com/hyperledger/fabric/orderer/common/server.Main()
        /opt/gopath/src/github.com/hyperledger/fabric/orderer/common/server/main.go:91 +0x1ce
main.main()
        /opt/gopath/src/github.com/hyperledger/fabric/orderer/main.go:15 +0x20

我去了那个地方,它在这个功能上。


func (msp *bccspmsp) sanitizeCert(cert *x509.Certificate) (*x509.Certificate, error) {
    if isECDSASignedCert(cert) {
        // Lookup for a parent certificate to perform the sanitization
        var parentCert *x509.Certificate
        chain, err := msp.getUniqueValidationChain(cert, msp.getValidityOptsForCert(cert))
        if err != nil {
            return nil, err
        }

        // at this point, cert might be a root CA certificate
        // or an intermediate CA certificate
        if cert.IsCA && len(chain) == 1 {
            // cert is a root CA certificate
            parentCert = cert
        } else {
            parentCert = chain[1]
        }

        // Sanitize
        cert, err = sanitizeECDSASignedCert(cert, parentCert)
        if err != nil {
            return nil, err
        }
    }
    return cert, nil
}

打开

parentCert = chain[1]

我知道这是我的configtx文件上的创世纪块上的问题,按照错误代码,我想这是在看ca文件。

因此,我猜我已经查看了文件,这是我使用的以下结构:

  • msp
    • admincerts(管理员的证书)
    • tlscacerts(tls-ca的tls证书)
    • cacerts(ca证书的tls证书)

据我所知,一切都是正确的广告。

编辑1:

如果将日志置于调试模式,则会给出相同的错误信息,但在以下情况之后发生:

2019-07-11 08:45:00.119 UTC [common.channelconfig] NewStandardValues -> DEBU 0ed Initializing protos for *channelconfig.OrdererProtos
2019-07-11 08:45:00.119 UTC [common.channelconfig] initializeProtosStruct -> DEBU 0ee Processing field: ConsensusType
2019-07-11 08:45:00.119 UTC [common.channelconfig] initializeProtosStruct -> DEBU 0ef Processing field: BatchSize
2019-07-11 08:45:00.119 UTC [common.channelconfig] initializeProtosStruct -> DEBU 0f0 Processing field: BatchTimeout
2019-07-11 08:45:00.119 UTC [common.channelconfig] initializeProtosStruct -> DEBU 0f1 Processing field: KafkaBrokers
2019-07-11 08:45:00.120 UTC [common.channelconfig] initializeProtosStruct -> DEBU 0f2 Processing field: ChannelRestrictions
2019-07-11 08:45:00.120 UTC [common.channelconfig] initializeProtosStruct -> DEBU 0f3 Processing field: Capabilities
2019-07-11 08:45:00.120 UTC [common.channelconfig] NewStandardValues -> DEBU 0f4 Initializing protos for *channelconfig.OrganizationProtos
2019-07-11 08:45:00.120 UTC [common.channelconfig] initializeProtosStruct -> DEBU 0f5 Processing field: MSP
2019-07-11 08:45:00.120 UTC [common.channelconfig] validateMSP -> DEBU 0f6 Setting up MSP for org OrgMSP
2019-07-11 08:45:00.120 UTC [msp] newBccspMsp -> DEBU 0f7 Creating BCCSP-based MSP instance
2019-07-11 08:45:00.120 UTC [msp] New -> DEBU 0f8 Creating Cache-MSP instance
2019-07-11 08:45:00.120 UTC [msp] Setup -> DEBU 0f9 Setting up MSP instance OrgMSP
2019-07-11 08:45:00.120 UTC [msp.identity] newIdentity -> DEBU 0fa Creating identity instance for cert 

1 个答案:

答案 0 :(得分:1)

好像cacertstlscacerts的内容是错误的。

cacerts应该包含签署管理员证书的CA根证书

tlscacerts应该包含用于签署TLS证书的CA根证书。