Skip to content

Commit 760e432

Browse files
authored
feat(spcli): add --all-deals to lotus-miner actor settle-deal (#13243)
* add --all-deals to `lotus-miner actor settle-deal` * update CHANGELOG.md
1 parent 33b9397 commit 760e432

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ This is the Lotus v1.33.1 release, which introduces performance improvements and
4444
- chore: bump the pubsub validation queue length to 256 ([filecoin-project/lotus#13176](https://github.com/filecoin-project/lotus/pull/13176))
4545
- chore(deps): update of critical underlying dependencies with go-libp2p to v0.42.0 (filecoin-project/lotus#13190) and boxo to v0.32.0 ([filecoin-project/lotus#13202](https://github.com/filecoin-project/lotus/pull/13202)) and boxo v0.33.0([filecoin-project/lotus#13226](https://github.com/filecoin-project/lotus/pull/13226))
4646
- feat(spcli): correctly handle the batch logic of `lotus-miner actor settle-deal`; replace the dealid data source ([filecoin-project/lotus#13189](https://github.com/filecoin-project/lotus/pull/13189))
47+
- feat(spcli): add `--all-deals` to `lotus-miner actor settle-deal`. By default, only expired deals are processed ([filecoin-project/lotus#13243](https://github.com/filecoin-project/lotus/pull/13243))
4748

4849
## 📝 Changelog
4950

cli/spcli/actor.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ func ActorDealSettlementCmd(getActor ActorAddressGetter) *cli.Command {
6565
Name: "skip-wait-msg",
6666
Usage: "skip to check the message status",
6767
},
68+
&cli.BoolFlag{
69+
Name: "all-deals",
70+
Usage: "settle all deals. only expired deals are calculated by default",
71+
},
6872
&cli.BoolFlag{
6973
Name: "really-do-it",
7074
Usage: "Actually send transaction performing the action",
@@ -97,6 +101,12 @@ func ActorDealSettlementCmd(getActor ActorAddressGetter) *cli.Command {
97101
}
98102
}
99103

104+
head, err := api.ChainHead(ctx)
105+
if err != nil {
106+
return err
107+
}
108+
alldeals := cctx.Bool("all-deals")
109+
100110
var (
101111
dealIDs []uint64
102112
dealId uint64
@@ -152,7 +162,13 @@ func ActorDealSettlementCmd(getActor ActorAddressGetter) *cli.Command {
152162
return xerrors.Errorf("Error getting all deals for miner: %w", err)
153163
}
154164
for _, deal := range data {
155-
dealIDs = append(dealIDs, uint64(deal))
165+
marketDeal, err := api.StateMarketStorageDeal(ctx, deal, types.EmptyTSK)
166+
if err != nil {
167+
continue
168+
}
169+
if marketDeal.Proposal.EndEpoch < head.Height() || alldeals {
170+
dealIDs = append(dealIDs, uint64(deal))
171+
}
156172
}
157173
}
158174
}

documentation/en/cli-lotus-miner.md

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)