@@ -17,6 +17,7 @@ import (
17
17
"golang.org/x/xerrors"
18
18
19
19
"github.com/filecoin-project/go-f3/gpbft"
20
+ lcli "github.com/filecoin-project/lotus/cli"
20
21
cliutil "github.com/filecoin-project/lotus/cli/util"
21
22
"github.com/filecoin-project/lotus/node/repo"
22
23
)
@@ -90,23 +91,27 @@ var f3GenExplicitPower = &cli.Command{
90
91
Usage : "the iteration of randomization, random entries will be exclusive across iterations" ,
91
92
Value : 0 ,
92
93
},
94
+ & cli.StringFlag {
95
+ Name : "tipset" ,
96
+ Usage : "specify tipset to call method on (pass comma separated array of cids) or @epoch" ,
97
+ },
93
98
},
94
99
95
100
Action : func (cctx * cli.Context ) error {
101
+ ctx := cliutil .ReqContext (cctx )
96
102
api , closer , err := cliutil .GetFullNodeAPIV1 (cctx )
97
103
if err != nil {
98
104
return fmt .Errorf ("getting api: %w" , err )
99
105
}
100
- if cctx .IsSet ("N" ) && cctx .IsSet ("ratio" ) {
101
- return fmt .Errorf ("N and ratio options are exclusive" )
102
- }
103
-
104
106
defer closer ()
105
- ctx := cliutil . ReqContext ( cctx )
106
- ts , err := api . ChainHead (ctx )
107
+
108
+ ts , err := lcli . LoadTipSet (ctx , cctx , api )
107
109
if err != nil {
108
110
return fmt .Errorf ("getting chain head: %w" , err )
109
111
}
112
+ if cctx .IsSet ("N" ) && cctx .IsSet ("ratio" ) {
113
+ return fmt .Errorf ("N and ratio options are exclusive" )
114
+ }
110
115
111
116
allPowerEntries , err := api .F3GetECPowerTable (ctx , ts .Key ())
112
117
if err != nil {
@@ -144,7 +149,9 @@ var f3GenExplicitPower = &cli.Command{
144
149
}
145
150
146
151
for _ , id := range goodList {
147
- add (id )
152
+ if _ , ok := powerMap [id ]; ok {
153
+ add (id )
154
+ }
148
155
}
149
156
150
157
seed := cctx .Int64 ("seed" )
0 commit comments