diff --git a/peer/channel/channel.go b/peer/channel/channel.go index 51685f028fb..ab8d56ec1a1 100644 --- a/peer/channel/channel.go +++ b/peer/channel/channel.go @@ -55,7 +55,7 @@ var ( genesisBlockPath string // create related variables - chainID string + channelID string channelTxFile string orderingEndpoint string tls bool @@ -100,7 +100,7 @@ func resetFlags() { flags = &pflag.FlagSet{} flags.StringVarP(&genesisBlockPath, "blockpath", "b", common.UndefinedParamValue, "Path to file containing genesis block") - flags.StringVarP(&chainID, "channelID", "c", common.UndefinedParamValue, "In case of a newChain command, the channel ID to create.") + flags.StringVarP(&channelID, "channelID", "c", common.UndefinedParamValue, "In case of a newChain command, the channel ID to create.") flags.StringVarP(&channelTxFile, "file", "f", "", "Configuration transaction file generated by a tool such as configtxgen for submitting to orderer") flags.IntVarP(&timeout, "timeout", "t", 5, "Channel creation timeout") } @@ -185,7 +185,7 @@ func InitCmdFactory(isEndorserRequired EndorserRequirement, isOrdererRequired Or return nil, fmt.Errorf("Error connecting due to %s", err) } - cmdFact.DeliverClient = newDeliverClient(conn, client, chainID) + cmdFact.DeliverClient = newDeliverClient(conn, client, channelID) } logger.Infof("Endorser and orderer connections initialized") return cmdFact, nil diff --git a/peer/channel/create.go b/peer/channel/create.go index ee3413393c5..93d9ae51731 100644 --- a/peer/channel/create.go +++ b/peer/channel/create.go @@ -76,7 +76,7 @@ func createChannelFromDefaults(cf *ChannelCmdFactory) (*cb.Envelope, error) { return nil, err } - chCrtEnv, err := encoder.MakeChannelCreationTransaction(chainID, genesisconfig.SampleConsortiumName, signer, nil) + chCrtEnv, err := encoder.MakeChannelCreationTransaction(channelID, genesisconfig.SampleConsortiumName, signer, nil) if err != nil { return nil, err @@ -119,12 +119,12 @@ func sanityCheckAndSignConfigTx(envConfigUpdate *cb.Envelope) (*cb.Envelope, err // Specifying the chainID on the CLI is usually redundant, as a hack, set it // here if it has not been set explicitly - if chainID == "" { - chainID = ch.ChannelId + if channelID == "" { + channelID = ch.ChannelId } - if ch.ChannelId != chainID { - return nil, InvalidCreateTx(fmt.Sprintf("mismatched channel ID %s != %s", ch.ChannelId, chainID)) + if ch.ChannelId != channelID { + return nil, InvalidCreateTx(fmt.Sprintf("mismatched channel ID %s != %s", ch.ChannelId, channelID)) } configUpdateEnv, err := configtx.UnmarshalConfigUpdateEnvelope(payload.Data) @@ -146,7 +146,7 @@ func sanityCheckAndSignConfigTx(envConfigUpdate *cb.Envelope) (*cb.Envelope, err configUpdateEnv.Signatures = append(configUpdateEnv.Signatures, configSig) - return utils.CreateSignedEnvelope(cb.HeaderType_CONFIG_UPDATE, chainID, signer, configUpdateEnv, 0, 0) + return utils.CreateSignedEnvelope(cb.HeaderType_CONFIG_UPDATE, channelID, signer, configUpdateEnv, 0, 0) } func sendCreateChainTransaction(cf *ChannelCmdFactory) error { @@ -196,7 +196,7 @@ func executeCreate(cf *ChannelCmdFactory) error { return err } - file := chainID + ".block" + file := channelID + ".block" if err = ioutil.WriteFile(file, b, 0644); err != nil { return err } @@ -206,7 +206,7 @@ func executeCreate(cf *ChannelCmdFactory) error { func create(cmd *cobra.Command, args []string, cf *ChannelCmdFactory) error { //the global chainID filled by the "-c" command - if chainID == common.UndefinedParamValue { + if channelID == common.UndefinedParamValue { return errors.New("Must supply channel ID") } diff --git a/peer/channel/create_test.go b/peer/channel/create_test.go index 3f0908998ec..831fdc6639a 100644 --- a/peer/channel/create_test.go +++ b/peer/channel/create_test.go @@ -575,10 +575,10 @@ func TestSanityCheckAndSignChannelCreateTx(t *testing.T) { // Error case 4 mockchannel := "mockchannel" - cid := chainID - chainID = mockchannel + cid := channelID + channelID = mockchannel defer func() { - chainID = cid + channelID = cid }() ch := &cb.ChannelHeader{Type: int32(cb.HeaderType_CONFIG_UPDATE), ChannelId: mockchannel} data, err = proto.Marshal(ch) diff --git a/peer/channel/fetchconfig.go b/peer/channel/fetchconfig.go index e22c6799f9d..f9a24150f35 100644 --- a/peer/channel/fetchconfig.go +++ b/peer/channel/fetchconfig.go @@ -97,7 +97,7 @@ func fetch(cmd *cobra.Command, args []string, cf *ChannelCmdFactory) error { var file string if len(args) == 1 { - file = chainID + "_" + args[0] + ".block" + file = channelID + "_" + args[0] + ".block" } else { file = args[1] } diff --git a/peer/channel/getinfo.go b/peer/channel/getinfo.go index cd2ba6e9078..031210f0c07 100644 --- a/peer/channel/getinfo.go +++ b/peer/channel/getinfo.go @@ -46,7 +46,7 @@ func (cc *endorserClient) getBlockChainInfo() (*cb.BlockchainInfo, error) { ChaincodeSpec: &pb.ChaincodeSpec{ Type: pb.ChaincodeSpec_Type(pb.ChaincodeSpec_Type_value["GOLANG"]), ChaincodeId: &pb.ChaincodeID{Name: "qscc"}, - Input: &pb.ChaincodeInput{Args: [][]byte{[]byte(qscc.GetChainInfo), []byte(chainID)}}, + Input: &pb.ChaincodeInput{Args: [][]byte{[]byte(qscc.GetChainInfo), []byte(channelID)}}, }, } @@ -84,7 +84,7 @@ func (cc *endorserClient) getBlockChainInfo() (*cb.BlockchainInfo, error) { func getinfo(cf *ChannelCmdFactory) error { //the global chainID filled by the "-c" command - if chainID == common.UndefinedParamValue { + if channelID == common.UndefinedParamValue { return errors.New("Must supply channel ID") } diff --git a/peer/channel/join.go b/peer/channel/join.go index 7c3cb4096f7..064315452ff 100644 --- a/peer/channel/join.go +++ b/peer/channel/join.go @@ -124,7 +124,7 @@ func executeJoin(cf *ChannelCmdFactory) (err error) { if proposalResp.Response.Status != 0 && proposalResp.Response.Status != 200 { return ProposalFailedErr(fmt.Sprintf("bad proposal response %d", proposalResp.Response.Status)) } - logger.Infof("Peer joined the channel!") + logger.Infof("Successfully submitted proposal to join channel '%s'", channelID) return nil } diff --git a/peer/channel/update.go b/peer/channel/update.go index adc856bc3b8..115063944ea 100644 --- a/peer/channel/update.go +++ b/peer/channel/update.go @@ -48,7 +48,7 @@ func updateCmd(cf *ChannelCmdFactory) *cobra.Command { func update(cmd *cobra.Command, args []string, cf *ChannelCmdFactory) error { //the global chainID filled by the "-c" command - if chainID == common.UndefinedParamValue { + if channelID == common.UndefinedParamValue { return errors.New("Must supply channel ID") }