From c2e469095ccc0bb3146df2b8d0ee21eebb1df7fb Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 29 Nov 2022 14:51:52 -0500 Subject: [PATCH] Check upper bound for deal duration --- cli/client.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cli/client.go b/cli/client.go index 377505363..1c41262a5 100644 --- a/cli/client.go +++ b/cli/client.go @@ -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 }