Skip to content

Commit 8107cee

Browse files
committed
Fix good list with no power and allow to specify tipset
Signed-off-by: Jakub Sztandera <[email protected]>
1 parent 5634558 commit 8107cee

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

cmd/lotus-shed/f3.go

+14-7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"golang.org/x/xerrors"
1818

1919
"github.com/filecoin-project/go-f3/gpbft"
20+
lcli "github.com/filecoin-project/lotus/cli"
2021
cliutil "github.com/filecoin-project/lotus/cli/util"
2122
"github.com/filecoin-project/lotus/node/repo"
2223
)
@@ -90,23 +91,27 @@ var f3GenExplicitPower = &cli.Command{
9091
Usage: "the iteration of randomization, random entries will be exclusive across iterations",
9192
Value: 0,
9293
},
94+
&cli.StringFlag{
95+
Name: "tipset",
96+
Usage: "specify tipset to call method on (pass comma separated array of cids) or @epoch",
97+
},
9398
},
9499

95100
Action: func(cctx *cli.Context) error {
101+
ctx := cliutil.ReqContext(cctx)
96102
api, closer, err := cliutil.GetFullNodeAPIV1(cctx)
97103
if err != nil {
98104
return fmt.Errorf("getting api: %w", err)
99105
}
100-
if cctx.IsSet("N") && cctx.IsSet("ratio") {
101-
return fmt.Errorf("N and ratio options are exclusive")
102-
}
103-
104106
defer closer()
105-
ctx := cliutil.ReqContext(cctx)
106-
ts, err := api.ChainHead(ctx)
107+
108+
ts, err := lcli.LoadTipSet(ctx, cctx, api)
107109
if err != nil {
108110
return fmt.Errorf("getting chain head: %w", err)
109111
}
112+
if cctx.IsSet("N") && cctx.IsSet("ratio") {
113+
return fmt.Errorf("N and ratio options are exclusive")
114+
}
110115

111116
allPowerEntries, err := api.F3GetECPowerTable(ctx, ts.Key())
112117
if err != nil {
@@ -144,7 +149,9 @@ var f3GenExplicitPower = &cli.Command{
144149
}
145150

146151
for _, id := range goodList {
147-
add(id)
152+
if _, ok := powerMap[id]; ok {
153+
add(id)
154+
}
148155
}
149156

150157
seed := cctx.Int64("seed")

0 commit comments

Comments
 (0)