Skip to content

Commit

Permalink
Explicitly notify about chain id usage (#1494)
Browse files Browse the repository at this point in the history
Include comment in flag help and verify it when building genesis for Polybft
  • Loading branch information
vcastellm committed May 11, 2023
1 parent 405ad1a commit 8ea9136
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion command/genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func setFlags(cmd *cobra.Command) {
&params.chainID,
chainIDFlag,
command.DefaultChainID,
"the ID of the chain",
"the ID of the chain (only used for IBFT consensus)",
)

cmd.Flags().StringVar(
Expand Down
5 changes: 5 additions & 0 deletions command/genesis/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ var (
errInvalidTokenParams = errors.New("native token params were not submitted in proper format " +
"(<name:symbol:decimals count:mintable flag>)")
errRewardWalletAmountZero = errors.New("reward wallet amount can not be zero or negative")
errChainIDPolyBFT = errors.New("chain id can not be set for polybft consensus")
)

type genesisParams struct {
Expand Down Expand Up @@ -150,6 +151,10 @@ func (p *genesisParams) validateFlags() error {
if err := p.validateRewardWallet(); err != nil {
return err
}

if p.chainID != command.DefaultChainID {
return errChainIDPolyBFT
}
}

// Check if the genesis file already exists
Expand Down

0 comments on commit 8ea9136

Please sign in to comment.