i forced pushed and brought a bug that was fixed back so im fixing it back
This commit is contained in:
parent
8c4c2eeffc
commit
fac769ff17
@ -5,12 +5,15 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||||
"github.com/filecoin-project/lotus/chain/consensus/filcns"
|
"github.com/filecoin-project/lotus/chain/consensus/filcns"
|
||||||
@ -26,6 +29,7 @@ import (
|
|||||||
var terminationsCmd = &cli.Command{
|
var terminationsCmd = &cli.Command{
|
||||||
Name: "terminations",
|
Name: "terminations",
|
||||||
Description: "Lists terminated deals from the past 2 days",
|
Description: "Lists terminated deals from the past 2 days",
|
||||||
|
ArgsUsage: "[block to look back from] [lookback period (epochs)]",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "repo",
|
Name: "repo",
|
||||||
@ -35,8 +39,8 @@ var terminationsCmd = &cli.Command{
|
|||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
ctx := context.TODO()
|
ctx := context.TODO()
|
||||||
|
|
||||||
if !cctx.Args().Present() {
|
if cctx.NArg() != 2 {
|
||||||
return fmt.Errorf("must pass block cid")
|
return fmt.Errorf("must pass block cid && lookback period")
|
||||||
}
|
}
|
||||||
|
|
||||||
blkCid, err := cid.Decode(cctx.Args().First())
|
blkCid, err := cid.Decode(cctx.Args().First())
|
||||||
@ -85,12 +89,14 @@ var terminationsCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
minerCode, err := miner.GetActorCodeID(actors.Version6)
|
lbp, err := strconv.Atoi(cctx.Args().Get(1))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return fmt.Errorf("failed to parse input: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < 2880*2; i++ {
|
cutoff := blk.Height - abi.ChainEpoch(lbp)
|
||||||
|
|
||||||
|
for blk.Height > cutoff {
|
||||||
pts, err := cs.LoadTipSet(types.NewTipSetKey(blk.Parents...))
|
pts, err := cs.LoadTipSet(types.NewTipSetKey(blk.Parents...))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -119,7 +125,7 @@ var terminationsCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if minerAct.Code != minerCode {
|
if !builtin.IsStorageMinerActor(minerAct.Code) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,10 +164,12 @@ var terminationsCmd = &cli.Command{
|
|||||||
for _, sector := range sectors {
|
for _, sector := range sectors {
|
||||||
for _, deal := range sector.DealIDs {
|
for _, deal := range sector.DealIDs {
|
||||||
prop, find, err := proposals.Get(deal)
|
prop, find, err := proposals.Get(deal)
|
||||||
if err != nil || !find {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Printf("%s, %d, %d, %s, %s, %s\n", msg.To, sector.SectorNumber, deal, prop.Client, prop.PieceCID, prop.Label)
|
if find {
|
||||||
|
fmt.Printf("%s, %d, %d, %s, %s, %s\n", msg.To, sector.SectorNumber, deal, prop.Client, prop.PieceCID, prop.Label)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user