@@ -213,17 +213,19 @@ impl SortitionsView {
213
213
. cur_sortition
214
214
. is_timed_out ( self . config . block_proposal_timeout , signer_db) ?
215
215
{
216
- // Note that this is only checking the current sortition, and it is
217
- // not necessarily related to the proposal being checked. For this
218
- // reason, we do not return an error here, just set the state and
219
- // log what happened.
220
216
info ! (
221
217
"Current miner timed out, marking as invalid." ;
222
218
"block_height" => block. header. chain_length,
223
219
"block_proposal_timeout" => ?self . config. block_proposal_timeout,
224
220
"current_sortition_consensus_hash" => ?self . cur_sortition. consensus_hash,
225
221
) ;
226
222
self . cur_sortition . miner_status = SortitionMinerStatus :: InvalidatedBeforeFirstBlock ;
223
+
224
+ // If the current proposal is also for this current
225
+ // sortition, then we can return early here.
226
+ if self . cur_sortition . consensus_hash == block. header . consensus_hash {
227
+ return Err ( RejectReason :: InvalidMiner ) ;
228
+ }
227
229
} else if let Some ( tip) = signer_db
228
230
. get_canonical_tip ( )
229
231
. map_err ( SignerChainstateError :: from) ?
@@ -250,17 +252,19 @@ impl SortitionsView {
250
252
& self . config . first_proposal_burn_block_timing ,
251
253
) ?;
252
254
if !is_valid_parent_tenure {
253
- // Note that this is only checking the current sortition,
254
- // and it is not necessarily related to the proposal being
255
- // checked. For this reason, we do not return an error
256
- // here, just set the state and log what happened.
257
255
warn ! (
258
256
"Current sortition does not build off of canonical tip tenure, marking as invalid" ;
259
257
"current_sortition_parent" => ?self . cur_sortition. parent_tenure_id,
260
258
"tip_consensus_hash" => ?tip. block. header. consensus_hash,
261
259
) ;
262
260
self . cur_sortition . miner_status =
263
261
SortitionMinerStatus :: InvalidatedBeforeFirstBlock ;
262
+
263
+ // If the current proposal is also for this current
264
+ // sortition, then we can return early here.
265
+ if self . cur_sortition . consensus_hash == block. header . consensus_hash {
266
+ return Err ( RejectReason :: ReorgNotAllowed ) ;
267
+ }
264
268
}
265
269
}
266
270
}
0 commit comments