Add a command to inspect sync state progress

This commit is contained in:
whyrusleeping
2019-09-30 15:06:47 -06:00
parent d692591411
commit af18cbac53
8 changed files with 186 additions and 0 deletions
+2
View File
@@ -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
}
+25
View File
@@ -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
}