Merge pull request #9753 from filecoin-project/gstuart/fix-devnet-deals

fix: cli: Check upper bound for deal duration
This commit is contained in:
Geoff Stuart 2022-12-12 09:33:23 -05:00 committed by GitHub
commit 33a176eae4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -627,7 +627,13 @@ uiLoop:
minDealDurationDays := uint64(build.MinDealDuration) / (builtin.SecondsInDay / build.BlockDelaySecs)
if days < int(minDealDurationDays) {
printErr(xerrors.Errorf("minimum duration is %d days", minDealDurationDays))
printErr(xerrors.Errorf("minimum duration is %d days, got %d", minDealDurationDays, days))
continue
}
maxDealDurationDays := uint64(build.MaxDealDuration) / (builtin.SecondsInDay / build.BlockDelaySecs)
if days > int(maxDealDurationDays) {
printErr(xerrors.Errorf("maximum duration is %d days, got %d", maxDealDurationDays, days))
continue
}