Skip to content

Commit 5f55333

Browse files
authored
feat: allow genesis timestamp to be specified in lotus-seed genesis new (#12923)
Allow genesis timestamp to be specified in `lotus-seed genesis new` Add the ability to specify the genesis timestamp in `lotus-seed genesis new` command in RFC-3339 format.
1 parent 57d6769 commit 5f55333

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cmd/lotus-seed/genesis.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"os"
88
"strconv"
99
"strings"
10+
"time"
1011

1112
"github.com/google/uuid"
1213
"github.com/mitchellh/go-homedir"
@@ -52,6 +53,12 @@ var genesisNewCmd = &cli.Command{
5253
&cli.StringFlag{
5354
Name: "network-name",
5455
},
56+
&cli.TimestampFlag{
57+
Name: "timestamp",
58+
Usage: "The genesis timestamp specified as a RFC3339 formatted string. Example: 2025-02-27T15:04:05Z",
59+
DefaultText: "No timestamp",
60+
Layout: time.RFC3339,
61+
},
5562
},
5663
Action: func(cctx *cli.Context) error {
5764
if !cctx.Args().Present() {
@@ -68,6 +75,9 @@ var genesisNewCmd = &cli.Command{
6875
if out.NetworkName == "" {
6976
out.NetworkName = "localnet-" + uuid.New().String()
7077
}
78+
if cctx.IsSet("timestamp") {
79+
out.Timestamp = uint64(cctx.Timestamp("timestamp").Unix())
80+
}
7181

7282
genb, err := json.MarshalIndent(&out, "", " ")
7383
if err != nil {

0 commit comments

Comments
 (0)