File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
stackslib/src/chainstate/stacks/boot Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -116,10 +116,11 @@ fn create_event_info_data_code(
116
116
// If a given burn block height is in a prepare phase, then the stacker will be in the _next_ reward cycle, so bump the cycle by 1
117
117
// `prepare_offset` is 1 or 0, depending on whether current execution is in a prepare phase or not
118
118
//
119
- // "is-in-next-pox-set" == effective-height <= (reward-length - prepare-length)
120
- // "<=" since the txs of the first block of the prepare phase are considered in the pox-set
119
+ // "is-in-next-pox-set" == effective-height < (cycle-length - prepare-length)
120
+ // "<" since the txs of the first block of the prepare phase are NOT considered in the pox-set,
121
+ // the pox-set is locked in the first block of the prepare phase, before the transactions of that block are run.
121
122
let pox_set_offset = r#"
122
- (pox-set-offset (if (<=
123
+ (pox-set-offset (if (<
123
124
(mod (- %height% (var-get first-burnchain-block-height)) (var-get pox-reward-cycle-length))
124
125
(- (var-get pox-reward-cycle-length) (var-get pox-prepare-cycle-length))
125
126
) u0 u1))
Original file line number Diff line number Diff line change @@ -2462,7 +2462,7 @@ fn pox_4_check_cycle_id_range_in_print_events_before_prepare_phase() {
2462
2462
while get_tip ( peer. sortdb . as_ref ( ) ) . block_height < u64:: from ( target_height) {
2463
2463
latest_block = Some ( peer. tenure_with_txs ( & [ ] , & mut coinbase_nonce) ) ;
2464
2464
}
2465
- // produce blocks until the we're 1 before the prepare phase (first block of prepare-phase not yet mined)
2465
+ // produce blocks until the we're 1 before the prepare phase (first block of prepare-phase not yet mined, whatever txs we create now won't be included in the reward set )
2466
2466
while !burnchain. is_in_prepare_phase ( get_tip ( peer. sortdb . as_ref ( ) ) . block_height + 1 ) {
2467
2467
latest_block = Some ( peer. tenure_with_txs ( & [ ] , & mut coinbase_nonce) ) ;
2468
2468
}
@@ -2519,7 +2519,7 @@ fn pox_4_check_cycle_id_range_in_print_events_before_prepare_phase() {
2519
2519
let steph_stacking_receipt = txs. get ( & steph_stacking. txid ( ) ) . unwrap ( ) . clone ( ) ;
2520
2520
assert_eq ! ( steph_stacking_receipt. events. len( ) , 2 ) ;
2521
2521
let steph_stacking_op_data = HashMap :: from ( [
2522
- ( "start-cycle-id" , Value :: UInt ( next_cycle) ) ,
2522
+ ( "start-cycle-id" , Value :: UInt ( next_cycle + 1 ) ) , // +1 because steph stacked in the block before the prepare phase (too late)
2523
2523
(
2524
2524
"end-cycle-id" ,
2525
2525
Value :: some ( Value :: UInt ( next_cycle + steph_lock_period) ) . unwrap ( ) ,
You can’t perform that action at this time.
0 commit comments