@@ -117,24 +117,8 @@ type CronEvent struct {
117
117
CallbackPayload []byte
118
118
}
119
119
120
- // MinerNominalPowerMeetsConsensusMinimum is used to validate Election PoSt
121
- // winners outside the chain state. If the miner has over a threshold of power
122
- // the miner meets the minimum. If the network is a below a threshold of
123
- // miners and has power > zero the miner meets the minimum.
124
- func (st * State ) MinerNominalPowerMeetsConsensusMinimum (s adt.Store , miner addr.Address ) (bool , error ) { //nolint:deadcode,unused
125
- claims , err := adt .AsMap (s , st .Claims , builtin .DefaultHamtBitwidth )
126
- if err != nil {
127
- return false , xerrors .Errorf ("failed to load claims: %w" , err )
128
- }
129
-
130
- claim , ok , err := getClaim (claims , miner )
131
- if err != nil {
132
- return false , err
133
- }
134
- if ! ok {
135
- return false , xerrors .Errorf ("no claim for actor %w" , miner )
136
- }
137
-
120
+ // ClaimMeetsConsensusMinimums checks if given claim meets the minimums set by the network for mining.
121
+ func (st * State ) ClaimMeetsConsensusMinimums (claim * Claim ) (bool , error ) {
138
122
minerNominalPower := claim .RawBytePower
139
123
minerMinPower , err := builtin .ConsensusMinerMinPower (claim .WindowPoStProofType )
140
124
if err != nil {
@@ -155,6 +139,27 @@ func (st *State) MinerNominalPowerMeetsConsensusMinimum(s adt.Store, miner addr.
155
139
return minerNominalPower .GreaterThan (abi .NewStoragePower (0 )), nil
156
140
}
157
141
142
+ // MinerNominalPowerMeetsConsensusMinimum is used to validate Election PoSt
143
+ // winners outside the chain state. If the miner has over a threshold of power
144
+ // the miner meets the minimum. If the network is a below a threshold of
145
+ // miners and has power > zero the miner meets the minimum.
146
+ func (st * State ) MinerNominalPowerMeetsConsensusMinimum (s adt.Store , miner addr.Address ) (bool , error ) { //nolint:deadcode,unused
147
+ claims , err := adt .AsMap (s , st .Claims , builtin .DefaultHamtBitwidth )
148
+ if err != nil {
149
+ return false , xerrors .Errorf ("failed to load claims: %w" , err )
150
+ }
151
+
152
+ claim , ok , err := getClaim (claims , miner )
153
+ if err != nil {
154
+ return false , err
155
+ }
156
+ if ! ok {
157
+ return false , xerrors .Errorf ("no claim for actor %w" , miner )
158
+ }
159
+
160
+ return st .ClaimMeetsConsensusMinimums (claim )
161
+ }
162
+
158
163
func (st * State ) GetClaim (s adt.Store , a addr.Address ) (* Claim , bool , error ) {
159
164
claims , err := adt .AsMap (s , st .Claims , builtin .DefaultHamtBitwidth )
160
165
if err != nil {
0 commit comments