Skip to content

Commit bea3ec9

Browse files
authored
reject deals longer than sector (#1916)
1 parent 73ca93a commit bea3ec9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

storagemarket/direct_deals_provider.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
lapi "github.com/filecoin-project/lotus/api"
2929
"github.com/filecoin-project/lotus/api/v1api"
3030
minertypes "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
31+
"github.com/filecoin-project/lotus/chain/actors/policy"
3132
ltypes "github.com/filecoin-project/lotus/chain/types"
3233
lotuspiece "github.com/filecoin-project/lotus/storage/pipeline/piece"
3334
"github.com/google/uuid"
@@ -136,6 +137,15 @@ func (ddp *DirectDealsProvider) Accept(ctx context.Context, entry *types.DirectD
136137

137138
log.Infow("found allocation for client", "allocation", spew.Sdump(allocation))
138139

140+
// If the TermMin is longer than initial sector duration, the deal will be dropped from the sector
141+
if allocation.TermMin > miner13types.MaxSectorExpirationExtension-policy.SealRandomnessLookback {
142+
return &api.ProviderDealRejectionInfo{
143+
Accepted: false,
144+
Reason: fmt.Sprintf("allocation term min %d is longer than the sector lifetime %d", allocation.TermMin, miner13types.MaxSectorExpirationExtension-policy.SealRandomnessLookback),
145+
}, nil
146+
147+
}
148+
139149
allActive, err := ddp.directDealsDB.ListActive(ctx)
140150
if err != nil {
141151
return nil, fmt.Errorf("failed to get active deals: %w", err)

0 commit comments

Comments
 (0)