Make preparePost more readable

Co-Authored-By: Whyrusleeping <why@ipfs.io>
This commit is contained in:
Łukasz Magiera 2019-11-09 00:15:25 +01:00 committed by GitHub
parent aaacfd15cd
commit 5de600909e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,7 +149,9 @@ func (p *post) preparePost(ctx context.Context) error {
}
p.sset = sset
r, err := p.m.api.ChainGetRandomness(ctx, p.ts, nil, int(int64(p.ts.Height())-int64(p.ppe)+int64(build.PoStChallangeTime)+int64(build.PoStRandomnessLookback))) // TODO: review: check math
// Compute how many blocks back we have to look from the given tipset for the PoSt challenge
challengeLookback := int((int64(p.ts.Height())-int64(p.ppe))+int64(build.PoStChallangeTime)+int64(build.PoStRandomnessLookback))
r, err := p.m.api.ChainGetRandomness(ctx, p.ts, nil, challengeLookback)
if err != nil {
return xerrors.Errorf("failed to get chain randomness for post (ts=%d; ppe=%d): %w", p.ts.Height(), p.ppe, err)
}