Merge pull request #4065 from filecoin-project/asr/sync-validate

Add lotus shed util to validate a tipset
This commit is contained in:
Łukasz Magiera
2020-09-30 09:24:47 +02:00
committed by GitHub
9 changed files with 143 additions and 14 deletions
+19
View File
@@ -126,3 +126,22 @@ func (a *SyncAPI) SyncCheckBad(ctx context.Context, bcid cid.Cid) (string, error
return reason, nil
}
func (a *SyncAPI) SyncValidateTipset(ctx context.Context, tsk types.TipSetKey) (bool, error) {
ts, err := a.Syncer.ChainStore().LoadTipSet(tsk)
if err != nil {
return false, err
}
fts, err := a.Syncer.ChainStore().TryFillTipSet(ts)
if err != nil {
return false, err
}
err = a.Syncer.ValidateTipSet(ctx, fts, false)
if err != nil {
return false, err
}
return true, nil
}