removed unnecessary fmt.Sprintf, renamed flag to JoinValidatorSetFlag, and elaborated on its usage

Former-commit-id: 7e98ed54ff716b2da878f085ae1ff40472ce1966 [formerly fc5b4ec6ab005aedf8d0aa3206f27209aab65d71]
Former-commit-id: 4b17e2e49cf3df95a90be3fc7fb2bb66a96bbeed
This commit is contained in:
Terence Tsao
2018-02-26 18:07:09 -08:00
parent e028d5d8f0
commit 7dcef60a37
4 changed files with 8 additions and 10 deletions

View File

@@ -122,7 +122,7 @@ var (
utils.GpoBlocksFlag,
utils.GpoPercentileFlag,
utils.ExtraDataFlag,
utils.ValidatorSetFlag,
utils.JoinValidatorSetFlag,
configFileFlag,
}

View File

@@ -14,7 +14,7 @@ var (
Aliases: []string{"shard"},
Usage: "Start a sharding client",
ArgsUsage: "[endpoint]",
Flags: []cli.Flag{utils.DataDirFlag, utils.PasswordFileFlag, utils.NetworkIdFlag, utils.IPCPathFlag, utils.ValidatorSetFlag},
Flags: []cli.Flag{utils.DataDirFlag, utils.PasswordFileFlag, utils.NetworkIdFlag, utils.IPCPathFlag, utils.JoinValidatorSetFlag},
Category: "SHARDING COMMANDS",
Description: `
Launches a sharding client that connects to a running geth node and proposes collations to a Validator Manager Contract. This feature is a work in progress.

View File

@@ -539,9 +539,9 @@ var (
}
//Sharding Settings
ValidatorSetFlag = cli.BoolFlag{
JoinValidatorSetFlag = cli.BoolFlag{
Name: "validator",
Usage: "Join validator set",
Usage: "To become a validator with your sharding client, 100 ETH will be deposited from user's account into VMC ",
}
)

View File

@@ -56,11 +56,9 @@ func initVMC(c *Client) error {
// the account is not in the set, it will deposit 100ETH into contract.
func joinValidatorSet(c *Client) error {
// TODO: Check if account is already in validator set. Fetch this From
// the VMC contract's validator set
if c.ctx.GlobalBool(utils.ValidatorSetFlag.Name) {
if c.ctx.GlobalBool(utils.JoinValidatorSetFlag.Name) {
log.Info(fmt.Sprintf("Joining Validator Set"))
log.Info("Joining validator set")
txOps, err := c.createTXOps(depositSize)
if err != nil {
return fmt.Errorf("unable to intiate the deposit transaction: %v", err)
@@ -70,10 +68,10 @@ func joinValidatorSet(c *Client) error {
if err != nil {
return fmt.Errorf("unable to deposit eth and become a validator: %v", err)
}
log.Info(fmt.Sprintf("Deposited 100ETH into contract with transaction hash: %s", tx.Hash().String()))
log.Info(fmt.Sprintf("Deposited %dETH into contract with transaction hash: %s", depositSize, tx.Hash().String()))
} else {
log.Info(fmt.Sprintf("Not Joining Validator Set"))
log.Info("Not joining validator set")
}
return nil