Skip to content

Commit 590391f

Browse files
authored
chore: parameterise balance in lotus-seed genesis add-miner (#12915)
Parameterise balance in `lotus-shed add-miner` Allow the balance to be specified in `lotus-seed genesis add-miner` via `--balance` flag.
1 parent 46cf79f commit 590391f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

cmd/lotus-seed/genesis.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,12 @@ var genesisNewCmd = &cli.Command{
9090
var genesisAddMinerCmd = &cli.Command{
9191
Name: "add-miner",
9292
Description: "add genesis miner",
93-
Flags: []cli.Flag{},
93+
Flags: []cli.Flag{
94+
&cli.Int64Flag{
95+
Name: "balance",
96+
Value: 50_000_000,
97+
},
98+
},
9499
Action: func(cctx *cli.Context) error {
95100
if cctx.NArg() != 2 {
96101
return xerrors.New("seed genesis add-miner [genesis.json] [preseal.json]")
@@ -124,6 +129,7 @@ var genesisAddMinerCmd = &cli.Command{
124129
return xerrors.Errorf("unmarshal miner info: %w", err)
125130
}
126131

132+
balance := cctx.Int64("balance")
127133
for mn, miner := range miners {
128134
log.Infof("Adding miner %s to genesis template", mn)
129135
{
@@ -145,7 +151,7 @@ var genesisAddMinerCmd = &cli.Command{
145151
log.Infof("Giving %s some initial balance", miner.Owner)
146152
template.Accounts = append(template.Accounts, genesis.Actor{
147153
Type: genesis.TAccount,
148-
Balance: big.Mul(big.NewInt(50_000_000), big.NewInt(int64(buildconstants.FilecoinPrecision))),
154+
Balance: big.Mul(big.NewInt(balance), big.NewInt(int64(buildconstants.FilecoinPrecision))),
149155
Meta: (&genesis.AccountMeta{Owner: miner.Owner}).ActorMeta(),
150156
})
151157
}

0 commit comments

Comments
 (0)