Add a command to inspect sync state progress
This commit is contained in:
@@ -2,6 +2,7 @@ package impl
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/filecoin-project/go-lotus/node/impl/client"
|
||||
"github.com/filecoin-project/go-lotus/node/impl/paych"
|
||||
|
||||
@@ -23,6 +24,7 @@ type FullNodeAPI struct {
|
||||
paych.PaychAPI
|
||||
full.StateAPI
|
||||
full.WalletAPI
|
||||
full.SyncAPI
|
||||
|
||||
Miner *miner.Miner
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package full
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/filecoin-project/go-lotus/api"
|
||||
"github.com/filecoin-project/go-lotus/chain"
|
||||
"go.uber.org/fx"
|
||||
)
|
||||
|
||||
type SyncAPI struct {
|
||||
fx.In
|
||||
|
||||
Syncer *chain.Syncer
|
||||
}
|
||||
|
||||
func (a *SyncAPI) SyncState(ctx context.Context) (*api.SyncState, error) {
|
||||
ss := a.Syncer.State()
|
||||
return &api.SyncState{
|
||||
Base: ss.Base,
|
||||
Target: ss.Target,
|
||||
Stage: ss.Stage,
|
||||
Height: ss.Height,
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user