mirror of
https://github.com/filecoin-project/lotus.git
synced 2025-05-17 15:20:37 +08:00
feat(cli): lotus chain head --height to print epoch number
A simpler version of what's currently possible with: lotus chain list --format '<height>' --count 1
This commit is contained in:
@ -7,6 +7,7 @@
|
||||
- Reduce size of embedded genesis CAR files by removing WASM actor blocks and compressing with zstd. This reduces the `lotus` binary size by approximately 10 MiB. ([filecoin-project/lotus#12439](https://github.com/filecoin-project/lotus/pull/12439))
|
||||
- Add ChainSafe operated Calibration archival node to the bootstrap list ([filecoin-project/lotus#12517](https://github.com/filecoin-project/lotus/pull/12517))
|
||||
- Fix hotloop in F3 pariticpation API ([filecoin-project/lotus#12575](https://github.com/filecoin-project/lotus/pull/12575))
|
||||
- `lotus chain head` now supports a `--height` flag to print just the epoch number of the current chain head ([filecoin-project/lotus#12609](https://github.com/filecoin-project/lotus/pull/12609))
|
||||
|
||||
## Bug Fixes
|
||||
- Fix a bug in the `lotus-shed indexes backfill-events` command that may result in either duplicate events being backfilled where there are existing events (such an operation *should* be idempotent) or events erroneously having duplicate `logIndex` values when queried via ETH APIs. ([filecoin-project/lotus#12567](https://github.com/filecoin-project/lotus/pull/12567))
|
||||
@ -15,8 +16,6 @@
|
||||
|
||||
## Improvements
|
||||
|
||||
## Improvements
|
||||
|
||||
## Deps
|
||||
|
||||
# UNRELEASED Node v1.30.0
|
||||
|
14
cli/chain.go
14
cli/chain.go
@ -72,6 +72,12 @@ var ChainCmd = &cli.Command{
|
||||
var ChainHeadCmd = &cli.Command{
|
||||
Name: "head",
|
||||
Usage: "Print chain head",
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{
|
||||
Name: "height",
|
||||
Usage: "print just the epoch number of the chain head",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
afmt := NewAppFmt(cctx.App)
|
||||
|
||||
@ -87,8 +93,12 @@ var ChainHeadCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
for _, c := range head.Cids() {
|
||||
afmt.Println(c)
|
||||
if cctx.Bool("height") {
|
||||
afmt.Println(head.Height())
|
||||
} else {
|
||||
for _, c := range head.Cids() {
|
||||
afmt.Println(c)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
},
|
||||
|
@ -1616,6 +1616,7 @@ USAGE:
|
||||
lotus chain head [command options] [arguments...]
|
||||
|
||||
OPTIONS:
|
||||
--height print just the epoch number of the chain head (default: false)
|
||||
--help, -h show help
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user