diff --git a/integration/channelparticipation/channel_participation.go b/integration/channelparticipation/channel_participation.go index 2c5a1a318ed..88e68175d50 100644 --- a/integration/channelparticipation/channel_participation.go +++ b/integration/channelparticipation/channel_participation.go @@ -55,11 +55,11 @@ func GenerateJoinRequest(url, channel string, blockBytes []byte) *http.Request { func doBody(client *http.Client, req *http.Request) []byte { resp, err := client.Do(req) Expect(err).NotTo(HaveOccurred()) - Expect(resp.StatusCode).To(Equal(http.StatusCreated)) bodyBytes, err := ioutil.ReadAll(resp.Body) Expect(err).NotTo(HaveOccurred()) + fmt.Println(">>>>", string(bodyBytes)) + Expect(resp.StatusCode).To(Equal(http.StatusCreated)) resp.Body.Close() - return bodyBytes } diff --git a/integration/configtx/consenter_mapping_test.go b/integration/configtx/consenter_mapping_test.go index f5fde1ab760..cb37f319bab 100644 --- a/integration/configtx/consenter_mapping_test.go +++ b/integration/configtx/consenter_mapping_test.go @@ -51,6 +51,6 @@ var _ = Describe("ConfigTx ConsenterMapping", func() { o := &common.Orderers{} err = proto.Unmarshal(group.GetValues()["Orderers"].GetValue(), o) Expect(err).NotTo(HaveOccurred()) - Expect(len(o.GetConsenterMapping())).To(Equal(3)) + Expect(len(o.GetConsenterMapping())).To(Equal(4)) }) }) diff --git a/integration/nwo/components.go b/integration/nwo/components.go index a21171653d7..fcb0da58f91 100644 --- a/integration/nwo/components.go +++ b/integration/nwo/components.go @@ -11,7 +11,6 @@ import ( "io/ioutil" "net/http" - "github.com/hyperledger/fabric/integration/nwo/runner" . "github.com/onsi/gomega" "github.com/onsi/gomega/gexec" ) @@ -72,5 +71,5 @@ const CCEnvDefaultImage = "hyperledger/fabric-ccenv:latest" var RequiredImages = []string{ CCEnvDefaultImage, - runner.CouchDBDefaultImage, + //runner.CouchDBDefaultImage, } diff --git a/integration/nwo/fabricconfig/configtx.go b/integration/nwo/fabricconfig/configtx.go index 05d46732a89..122cbabbf0f 100644 --- a/integration/nwo/fabricconfig/configtx.go +++ b/integration/nwo/fabricconfig/configtx.go @@ -62,15 +62,24 @@ type Application struct { ExtraProperties map[string]interface{} `yaml:",inline,omitempty"` } +type ConsenterMapping struct { + ID uint64 + Host string + Port int + MSPID string + Identity string +} + type ConfigTxOrderer struct { - OrdererType string `yaml:"OrdererType,omitempty"` - BatchTimeout time.Duration `yaml:"BatchTimeout,omitempty"` - BatchSize *BatchSize `yaml:"BatchSize,omitempty"` - Kafka *ConfigTxKafka `yaml:"Kafka,omitempty"` - EtcdRaft *ConfigTxEtcdRaft `yaml:"EtcdRaft,omitempty"` - Organizations []*Organization `yaml:"Organizations,omitempty"` - Policies map[string]*Policy `yaml:"Policies,omitempty"` - Capabilities map[string]bool `yaml:"Capabilities,omitempty"` + OrdererType string `yaml:"OrdererType,omitempty"` + BatchTimeout time.Duration `yaml:"BatchTimeout,omitempty"` + BatchSize *BatchSize `yaml:"BatchSize,omitempty"` + Kafka *ConfigTxKafka `yaml:"Kafka,omitempty"` + EtcdRaft *ConfigTxEtcdRaft `yaml:"EtcdRaft,omitempty"` + ConsenterMapping []ConsenterMapping `yaml:"ConsenterMapping,omitempty"` + Organizations []*Organization `yaml:"Organizations,omitempty"` + Policies map[string]*Policy `yaml:"Policies,omitempty"` + Capabilities map[string]bool `yaml:"Capabilities,omitempty"` ExtraProperties map[string]interface{} `yaml:",inline,omitempty"` } diff --git a/integration/nwo/network.go b/integration/nwo/network.go index 0732fafaab3..43fddae1d93 100644 --- a/integration/nwo/network.go +++ b/integration/nwo/network.go @@ -89,6 +89,7 @@ type Channel struct { type Orderer struct { Name string `yaml:"name,omitempty"` Organization string `yaml:"organization,omitempty"` + Id int `yaml:"id,omitempty"` } // ID provides a unique identifier for an orderer instance. @@ -691,6 +692,12 @@ func (n *Network) OrdererLocalMSPDir(o *Orderer) string { return n.OrdererLocalCryptoDir(o, "msp") } +func (n *Network) OrdererSignCert(o *Orderer) string { + dirName := filepath.Join(n.OrdererLocalCryptoDir(o, "msp"), "signcerts") + fileName := fmt.Sprintf("%s.%s-cert.pem", o.Name, n.Organization(o.Organization).Domain) + return filepath.Join(dirName, fileName) +} + // OrdererLocalTLSDir returns the path to the local TLS directory for the // Orderer. func (n *Network) OrdererLocalTLSDir(o *Orderer) string { @@ -773,14 +780,16 @@ func (n *Network) Bootstrap() { n.bootstrapIdemix() - sess, err = n.ConfigTxGen(commands.OutputBlock{ - ChannelID: n.SystemChannel.Name, - Profile: n.SystemChannel.Profile, - ConfigPath: n.RootDir, - OutputBlock: n.OutputBlockPath(n.SystemChannel.Name), - }) - Expect(err).NotTo(HaveOccurred()) - Eventually(sess, n.EventuallyTimeout).Should(gexec.Exit(0)) + if n.SystemChannel != nil && n.SystemChannel.Name != "" { + sess, err = n.ConfigTxGen(commands.OutputBlock{ + ChannelID: n.SystemChannel.Name, + Profile: n.SystemChannel.Profile, + ConfigPath: n.RootDir, + OutputBlock: n.OutputBlockPath(n.SystemChannel.Name), + }) + Expect(err).NotTo(HaveOccurred()) + Eventually(sess, n.EventuallyTimeout).Should(gexec.Exit(0)) + } for _, c := range n.Channels { sess, err := n.ConfigTxGen(commands.CreateChannelTx{ diff --git a/integration/nwo/standard_networks.go b/integration/nwo/standard_networks.go index c744b171349..d7e2f641efb 100644 --- a/integration/nwo/standard_networks.go +++ b/integration/nwo/standard_networks.go @@ -292,17 +292,18 @@ func MultiNodeEtcdRaft() *Config { func MultiNodeBFT() *Config { config := BasicConfig() - + config.SystemChannel = nil config.Consensus.Type = "BFT" config.Orderers = []*Orderer{ {Name: "orderer1", Organization: "OrdererOrg"}, {Name: "orderer2", Organization: "OrdererOrg"}, {Name: "orderer3", Organization: "OrdererOrg"}, + {Name: "orderer4", Organization: "OrdererOrg"}, } config.Profiles = []*Profile{ { Name: "SampleDevModeBFT", - Orderers: []string{"orderer1", "orderer2", "orderer3"}, + Orderers: []string{"orderer1", "orderer2", "orderer3", "orderer4"}, }, { Name: "TwoOrgsChannel", @@ -317,7 +318,7 @@ func MultiNodeBFT() *Config { func BasicSmartBFT() *Config { config := BasicConfig() - config.Consensus.Type = "smartbft" + config.Consensus.Type = "BFT" config.Profiles = []*Profile{{ Name: "SampleDevModeSmartBFT", Orderers: []string{"orderer"}, @@ -326,33 +327,28 @@ func BasicSmartBFT() *Config { Consortium: "SampleConsortium", Organizations: []string{"Org1", "Org2"}, }} - /* for _, peer := range config.Peers { - peer.BFTDeliveryClient = true - } */ - config.SystemChannel.Profile = "SampleDevModeSmartBFT" return config } func MultiNodeSmartBFT() *Config { config := BasicSmartBFT() config.Orderers = []*Orderer{ - {Name: "orderer1", Organization: "OrdererOrg"}, - {Name: "orderer2", Organization: "OrdererOrg"}, - {Name: "orderer3", Organization: "OrdererOrg"}, - {Name: "orderer4", Organization: "OrdererOrg"}, + {Name: "orderer1", Organization: "OrdererOrg", Id: 1}, + {Name: "orderer2", Organization: "OrdererOrg", Id: 2}, + {Name: "orderer3", Organization: "OrdererOrg", Id: 3}, + {Name: "orderer4", Organization: "OrdererOrg", Id: 4}, } config.Profiles = []*Profile{{ - Name: "SampleDevModeSmartBFT", - Orderers: []string{"orderer1", "orderer2", "orderer3", "orderer4"}, - }, { - Name: "TwoOrgsChannel", - Consortium: "SampleConsortium", - Organizations: []string{"Org1", "Org2"}, + ChannelCapabilities: []string{"V3_0"}, + Name: "SampleDevModeSmartBFT", + Orderers: []string{"orderer1", "orderer2", "orderer3", "orderer4"}, + Organizations: []string{"Org1", "Org2"}, + AppCapabilities: []string{"V2_0"}, }} config.Channels = []*Channel{ - {Name: "testchannel1", Profile: "TwoOrgsChannel"}, - {Name: "testchannel2", Profile: "TwoOrgsChannel"}, + {Name: "testchannel1", Profile: "SampleDevModeSmartBFT"}, + {Name: "testchannel2", Profile: "SampleDevModeSmartBFT"}, } for _, peer := range config.Peers { diff --git a/integration/nwo/template/configtx_template.go b/integration/nwo/template/configtx_template.go index b2c1cc67500..e41b63e9f55 100644 --- a/integration/nwo/template/configtx_template.go +++ b/integration/nwo/template/configtx_template.go @@ -150,20 +150,16 @@ Profiles:{{ range .Profiles }} AbsoluteMaxBytes: 98 MB PreferredMaxBytes: 512 KB Capabilities: - {{- if eq $w.Consensus.Type "BFT" }} - V3_0: true - {{- else }} V2_0: true - {{- end }} - {{- if eq $w.Consensus.Type "smartbft" }} + {{- if eq $w.Consensus.Type "BFT" }} ConsenterMapping:{{ range $index, $orderer := .Orderers }}{{ with $w.Orderer . }} - - ID: {{ $index }} + - ID: {{ .Id }} Host: 127.0.0.1 Port: {{ $w.OrdererPort . "Cluster" }} MSPID: {{ .Organization }} ClientTLSCert: {{ $w.OrdererLocalCryptoDir . "tls" }}/server.crt ServerTLSCert: {{ $w.OrdererLocalCryptoDir . "tls" }}/server.crt - Identity: {{ $w.OrdererLocalCryptoDir . "tls" }}/server.crt + Identity: {{ $w.OrdererSignCert .}} {{- end }}{{- end }} {{- end }} {{- if eq $w.Consensus.Type "etcdraft" }} @@ -195,8 +191,6 @@ Profiles:{{ range .Profiles }} Type: ImplicitMeta Rule: ANY Writers {{- end }} - {{- if .Consortium }} - Consortium: {{ .Consortium }} Application: Capabilities: {{- if .AppCapabilities }}{{ range .AppCapabilities }} @@ -224,6 +218,8 @@ Profiles:{{ range .Profiles }} Endorsement: Type: ImplicitMeta Rule: "MAJORITY Endorsement" + {{- if .Consortium }} + Consortium: {{ .Consortium }} {{- else }} Consortiums:{{ range $w.Consortiums }} {{ .Name }}: diff --git a/integration/smartbft/smartbft_test.go b/integration/smartbft/smartbft_test.go index de002e37e85..831ff7bf260 100644 --- a/integration/smartbft/smartbft_test.go +++ b/integration/smartbft/smartbft_test.go @@ -25,6 +25,10 @@ import ( "syscall" "time" + "github.com/golang/protobuf/proto" + + "github.com/hyperledger/fabric/integration/channelparticipation" + "github.com/tedsuo/ifrit/grouper" docker "github.com/fsouza/go-dockerclient" @@ -89,7 +93,12 @@ var _ = Describe("EndToEnd Smart BFT configuration test", func() { Describe("smartbft network", func() { It("smartbft multiple nodes stop start all nodes", func() { - network = nwo.New(nwo.MultiNodeSmartBFT(), testDir, client, StartPort(), components) + networkConfig := nwo.MultiNodeSmartBFT() + networkConfig.SystemChannel.Name = "" + networkConfig.Channels = nil + + network = nwo.New(networkConfig, testDir, client, StartPort(), components) + network.Consortiums = nil network.Consensus.ChannelParticipationEnabled = true network.Consensus.BootstrapMethod = "none" network.GenerateConfigTree() @@ -110,24 +119,39 @@ var _ = Describe("EndToEnd Smart BFT configuration test", func() { Eventually(peerProcesses.Ready(), network.EventuallyTimeout).Should(BeClosed()) peer := network.Peer("Org1", "peer0") - /* genesisBlock := applicationChannelGenesisBlock(network, network.Orderers, []*nwo.Peer{peer}, "participation-trophy") - expectedChannelInfoPT := channelparticipation.ChannelInfo{ - Name: "participation-trophy", - URL: "/participation/v1/channels/participation-trophy", - Status: "active", - ConsensusRelation: "consenter", - Height: 1, - } - - for _, o := range network.Orderers { - By("joining " + o.Name + " to channel as a consenter") - channelparticipation.Join(network, o, "participation-trophy", genesisBlock, expectedChannelInfoPT) - channelInfo := channelparticipation.ListOne(network, o, "participation-trophy") - Expect(channelInfo).To(Equal(expectedChannelInfoPT)) - } - - Eventually(ordererRunners[1].Err(), 120*time.Second, time.Second).Should(gbytes.Say("Message from 1")) - Fail("stop here") */ + sess, err := network.ConfigTxGen(commands.OutputBlock{ + ChannelID: "testchannel1", + Profile: network.Profiles[0].Name, + ConfigPath: network.RootDir, + OutputBlock: network.OutputBlockPath("testchannel1"), + }) + Expect(err).NotTo(HaveOccurred()) + Eventually(sess, network.EventuallyTimeout).Should(gexec.Exit(0)) + + genesisBlockBytes, err := os.ReadFile(network.OutputBlockPath("testchannel1")) + Expect(err).NotTo(HaveOccurred()) + + genesisBlock := &common.Block{} + err = proto.Unmarshal(genesisBlockBytes, genesisBlock) + Expect(err).NotTo(HaveOccurred()) + + expectedChannelInfoPT := channelparticipation.ChannelInfo{ + Name: "testchannel1", + URL: "/participation/v1/channels/testchannel1", + Status: "active", + ConsensusRelation: "consenter", + Height: 1, + } + + for _, o := range network.Orderers { + By("joining " + o.Name + " to channel as a consenter") + channelparticipation.Join(network, o, "testchannel1", genesisBlock, expectedChannelInfoPT) + channelInfo := channelparticipation.ListOne(network, o, "testchannel1") + Expect(channelInfo).To(Equal(expectedChannelInfoPT)) + } + + Eventually(ordererRunners[1].Err(), 120*time.Second, time.Second).Should(gbytes.Say("Message from 1")) + Fail("stop here") assertBlockReception(map[string]int{"systemchannel": 0}, network.Orderers, peer, network) /* By("check block validation policy on system channel") @@ -160,7 +184,7 @@ var _ = Describe("EndToEnd Smart BFT configuration test", func() { } By("querying the chaincode") - sess, err := network.PeerUserSession(peer, "User1", commands.ChaincodeQuery{ + sess, err = network.PeerUserSession(peer, "User1", commands.ChaincodeQuery{ ChannelID: channel, Name: "mycc", Ctor: `{"Args":["query","a"]}`, @@ -201,6 +225,51 @@ var _ = Describe("EndToEnd Smart BFT configuration test", func() { }) }) +/*func makeGenesisBlockFromChannelCreationTx(tx []byte) *common.Block { + env := &common.Envelope{} + err := proto.Unmarshal(tx, env) + Expect(err).NotTo(HaveOccurred()) + + payload := &common.Payload{} + err = proto.Unmarshal(env.Payload, payload) + Expect(err).NotTo(HaveOccurred()) + + configUpdateEnv, err := configtx2.UnmarshalConfigUpdateEnvelope(payload.Data) + Expect(err).NotTo(HaveOccurred()) + + confUpdate := &common.ConfigUpdate{} + proto.Unmarshal(configUpdateEnv.ConfigUpdate, confUpdate) + + confUpdate. + + chHdr := protoutil.UnmarshalChannelHeaderOrPanic(payload.Header.ChannelHeader) + chHdr.Type = int32(common.HeaderType_CONFIG) + payload.Header.ChannelHeader = protoutil.MarshalOrPanic(chHdr) + + env.Payload = protoutil.MarshalOrPanic(payload) + + metadata := &common.BlockMetadata{ + Metadata: make([][]byte, 4), + } + metadata.Metadata[common.BlockMetadataIndex_SIGNATURES] = protoutil.MarshalOrPanic(&common.OrdererBlockMetadata{ + LastConfig: &common.LastConfig{Index: 0}, + // This is a genesis block, peer never verify this signature because we can't bootstrap + // trust from an earlier block, hence there are no signatures here. + }) + metadata.Metadata[common.BlockMetadataIndex_LAST_CONFIG] = protoutil.MarshalOrPanic(&common.Metadata{ + Value: protoutil.MarshalOrPanic(&common.LastConfig{Index: 0}), + // This is a genesis block, peer never verify this signature because we can't bootstrap + // trust from an earlier block, hence there are no signatures here. + }) + + blockdata := &common.BlockData{Data: [][]byte{protoutil.MarshalOrPanic(env)}} + return &common.Block{ + Header: &common.BlockHeader{DataHash: protoutil.BlockDataHash(blockdata)}, + Data: blockdata, + Metadata: metadata, + } +} +*/ func invokeQuery(network *nwo.Network, peer *nwo.Peer, orderer *nwo.Orderer, channel string, expectedBalance int) { sess, err := network.PeerUserSession(peer, "User1", commands.ChaincodeInvoke{ ChannelID: channel, @@ -347,7 +416,7 @@ func applicationChannelGenesisBlock(n *nwo.Network, orderers []*nwo.Orderer, pee channelConfig := configtx.Channel{ Orderer: configtx.Orderer{ - OrdererType: "smartbft", + OrdererType: "etcdraft", Organizations: ordererOrgs, EtcdRaft: orderer.EtcdRaft{ Consenters: consenters, diff --git a/internal/configtxgen/encoder/encoder.go b/internal/configtxgen/encoder/encoder.go index e8b02854462..a5df65891ee 100644 --- a/internal/configtxgen/encoder/encoder.go +++ b/internal/configtxgen/encoder/encoder.go @@ -43,7 +43,7 @@ const ( // ConsensusTypeEtcdRaft identifies the Raft-based consensus implementation. ConsensusTypeEtcdRaft = "etcdraft" // ConsensusTypeBFT identifies the BFT-based consensus implementation. - ConsensusTypeBFT = "smartbft" + ConsensusTypeBFT = "BFT" // BlockValidationPolicyKey TODO BlockValidationPolicyKey = "BlockValidation" @@ -269,7 +269,7 @@ func consenterProtosFromConfig(consenterMapping []*genesisconfig.Consenter) ([]* if err != nil { return nil, fmt.Errorf("cannot load identity for consenter %s:%d: %s", c.GetHost(), c.GetPort(), err) } - c.ServerTlsCert = identity + c.Identity = identity } consenterProtos = append(consenterProtos, c) diff --git a/internal/configtxgen/genesisconfig/config.go b/internal/configtxgen/genesisconfig/config.go index de03f772a2d..bd594378ca7 100644 --- a/internal/configtxgen/genesisconfig/config.go +++ b/internal/configtxgen/genesisconfig/config.go @@ -25,7 +25,7 @@ import ( const ( // EtcdRaft The type key for etcd based RAFT consensus. EtcdRaft = "etcdraft" - SmartBFT = "smartbft" + BFT = "BFT" ) var logger = flogging.MustGetLogger("common.tools.configtxgen.localconfig") @@ -413,37 +413,34 @@ loop: cf.TranslatePathInPlace(configDir, &serverCertPath) c.ServerTlsCert = []byte(serverCertPath) } - case SmartBFT: - /* if len(ord.ConsenterMapping) == 0 { - logger.Panic("Orderer.Orderers.ConsenterMapping missing") - } */ + case BFT: if ord.SmartBFT == nil { logger.Infof("Orderer.SmartBFT.Options unset, setting to %v", genesisDefaults.Orderer.SmartBFT) ord.SmartBFT = genesisDefaults.Orderer.SmartBFT } if len(ord.ConsenterMapping) == 0 { - logger.Panicf("%s configuration did not specify any consenter", SmartBFT) + logger.Panicf("%s configuration did not specify any consenter", BFT) } for _, c := range ord.ConsenterMapping { if c.Host == "" { - logger.Panicf("consenter info in %s configuration did not specify host", SmartBFT) + logger.Panicf("consenter info in %s configuration did not specify host", BFT) } if c.Port == 0 { - logger.Panicf("consenter info in %s configuration did not specify port", SmartBFT) + logger.Panicf("consenter info in %s configuration did not specify port", BFT) } if c.ClientTLSCert == "" { - logger.Panicf("consenter info in %s configuration did not specify client TLS cert", SmartBFT) + logger.Panicf("consenter info in %s configuration did not specify client TLS cert", BFT) } if c.ServerTLSCert == "" { - logger.Panicf("consenter info in %s configuration did not specify server TLS cert", SmartBFT) + logger.Panicf("consenter info in %s configuration did not specify server TLS cert", BFT) } if len(c.MSPID) == 0 { - logger.Panicf("consenter info in %s configuration did not specify MSP ID", SmartBFT) + logger.Panicf("consenter info in %s configuration did not specify MSP ID", BFT) } if len(c.Identity) == 0 { - logger.Panicf("consenter info in %s configuration did not specify identity certificate", SmartBFT) + logger.Panicf("consenter info in %s configuration did not specify identity certificate", BFT) } cf.TranslatePathInPlace(configDir, &c.ClientTLSCert) diff --git a/orderer/common/server/main.go b/orderer/common/server/main.go index 891f5fee548..a5d09b524b5 100644 --- a/orderer/common/server/main.go +++ b/orderer/common/server/main.go @@ -825,7 +825,7 @@ func initializeMultichannelRegistrar( } } else if bootstrapBlock == nil { // without a system channel: assume cluster type, InactiveChainRegistry == nil, no go-routine. - consenterType := "smartbft" + consenterType := "BFT" bootstrapBlock := initSystemChannelWithJoinBlock(conf, bccsp, lf) if bootstrapBlock != nil { fmt.Println("DEBUG_bootstrapBlock is not nil") @@ -844,8 +844,8 @@ func initializeMultichannelRegistrar( switch consenterType { case "etcdraft": consenters["etcdraft"] = etcdraft.New(clusterDialer, conf, srvConf, srv, registrar, nil, metricsProvider, bccsp) - case "smartbft": - consenters["smartbft"] = smartbft.New(nil, dpmr.Registry(), signer, clusterDialer, conf, srvConf, srv, registrar, metricsProvider, bccsp) + case "BFT": + consenters["BFT"] = smartbft.New(nil, dpmr.Registry(), signer, clusterDialer, conf, srvConf, srv, registrar, metricsProvider, bccsp) default: logger.Panicf("Unknown cluster type consenter '%s'", consenterType) } diff --git a/orderer/consensus/smartbft/util.go b/orderer/consensus/smartbft/util.go index 744b2ca2c5e..cd48988bbf1 100644 --- a/orderer/consensus/smartbft/util.go +++ b/orderer/consensus/smartbft/util.go @@ -356,9 +356,12 @@ func RemoteNodesFromConfigBlock(block *cb.Block, selfID uint64, logger *flogging var remoteNodes []cluster.RemoteNode id2Identies := map[uint64][]byte{} for _, consenter := range oc.Consenters() { - sanitizedID, err := crypto.SanitizeIdentity(consenter.Identity) + sanitizedID, err := crypto.SanitizeIdentity(protoutil.MarshalOrPanic(&msp.SerializedIdentity{ + IdBytes: consenter.Identity, + Mspid: consenter.MspId, + })) if err != nil { - logger.Panicf("Failed to sanitize identity: %v", err) + logger.Panicf("Failed to sanitize identity: %v [%s]", err, string(consenter.Identity)) } id2Identies[(uint64)(consenter.Id)] = sanitizedID logger.Infof("%s %d ---> %s", bundle.ConfigtxValidator().ChannelID(), consenter.Id, string(consenter.Identity)) diff --git a/protoutil/commonutils.go b/protoutil/commonutils.go index 2ccdb9ac6f3..b4c242c35c4 100644 --- a/protoutil/commonutils.go +++ b/protoutil/commonutils.go @@ -190,23 +190,29 @@ func SignOrPanic(signer identity.Signer, msg []byte) []byte { func IsConfigBlock(block *cb.Block) bool { envelope, err := ExtractEnvelope(block, 0) if err != nil { + fmt.Println(">>>> 1", err) return false } payload, err := UnmarshalPayload(envelope.Payload) if err != nil { + fmt.Println(">>>>>", envelope.Payload) + fmt.Println(">>>> 2", err) return false } if payload.Header == nil { + fmt.Println(">>>> 3") return false } hdr, err := UnmarshalChannelHeader(payload.Header.ChannelHeader) if err != nil { + fmt.Println(">>>> 4") return false } + fmt.Println(">>>>>>>>>>>>>>>", hdr.Type) return cb.HeaderType(hdr.Type) == cb.HeaderType_CONFIG || cb.HeaderType(hdr.Type) == cb.HeaderType_ORDERER_TRANSACTION }