sync wait add heightDiff maybe useful!

This commit is contained in:
shepf 2020-09-19 14:04:48 +08:00
parent 6050401652
commit 6b40e1e30d

View File

@ -249,14 +249,24 @@ func SyncWait(ctx context.Context, napi api.FullNode) error {
ss := state.ActiveSyncs[working] ss := state.ActiveSyncs[working]
var baseHeight abi.ChainEpoch
var target []cid.Cid var target []cid.Cid
var theight abi.ChainEpoch var theight abi.ChainEpoch
var heightDiff int64
if ss.Base != nil {
baseHeight = ss.Base.Height()
heightDiff = int64(ss.Base.Height())
}
if ss.Target != nil { if ss.Target != nil {
target = ss.Target.Cids() target = ss.Target.Cids()
theight = ss.Target.Height() theight = ss.Target.Height()
heightDiff = int64(ss.Target.Height()) - heightDiff
} else {
heightDiff = 0
} }
fmt.Printf("\r\x1b[2KWorker %d: Target Height: %d\tTarget: %s\tState: %s\tHeight: %d", working, theight, target, ss.Stage, ss.Height) fmt.Printf("\r\x1b[2KWorker %d: Base Height: %d\tTarget Height: %d\t Height diff: %d\tTarget: %s\tState: %s\tHeight: %d", working, baseHeight, theight, heightDiff, target, ss.Stage, ss.Height)
if time.Now().Unix()-int64(head.MinTimestamp()) < int64(build.BlockDelaySecs) { if time.Now().Unix()-int64(head.MinTimestamp()) < int64(build.BlockDelaySecs) {
fmt.Println("\nDone!") fmt.Println("\nDone!")