@@ -115,7 +115,6 @@ impl BurnchainStateTransition {
115
115
parent_snapshot : & BlockSnapshot ,
116
116
block_ops : & Vec < BlockstackOperationType > ,
117
117
missed_commits : & Vec < MissedBlockCommit > ,
118
- sunset_end : u64 ,
119
118
) -> Result < BurnchainStateTransition , burnchain_error > {
120
119
// block commits and support burns discovered in this block.
121
120
let mut block_commits: Vec < LeaderBlockCommitOp > = vec ! [ ] ;
@@ -167,9 +166,7 @@ impl BurnchainStateTransition {
167
166
let mut windowed_block_commits = vec ! [ block_commits] ;
168
167
let mut windowed_missed_commits = vec ! [ ] ;
169
168
170
- if !burnchain. is_in_prepare_phase ( parent_snapshot. block_height + 1 )
171
- && parent_snapshot. block_height + 1 <= burnchain. pox_constants . sunset_end
172
- {
169
+ if !burnchain. is_in_prepare_phase ( parent_snapshot. block_height + 1 ) {
173
170
// PoX reward-phase is active!
174
171
// build a map of intended sortition -> missed commit for the missed commits
175
172
// discovered in this block.
@@ -212,7 +209,7 @@ impl BurnchainStateTransition {
212
209
} else {
213
210
// PoX reward-phase is not active
214
211
debug ! (
215
- "Block {} is in a prepare phase or post-PoX sunset , so no windowing will take place" ,
212
+ "Block {} is in a prepare phase, so no windowing will take place" ,
216
213
parent_snapshot. block_height + 1
217
214
) ;
218
215
@@ -224,18 +221,14 @@ impl BurnchainStateTransition {
224
221
windowed_block_commits. reverse ( ) ;
225
222
windowed_missed_commits. reverse ( ) ;
226
223
227
- // figure out if the PoX sunset finished during the window,
228
- // and/or which sortitions must be PoB due to them falling in a prepare phase.
224
+ // figure out which sortitions must be PoB due to them falling in a prepare phase.
229
225
let window_end_height = parent_snapshot. block_height + 1 ;
230
226
let window_start_height = window_end_height + 1 - ( windowed_block_commits. len ( ) as u64 ) ;
231
227
let mut burn_blocks = vec ! [ false ; windowed_block_commits. len( ) ] ;
232
228
233
- // set burn_blocks flags to accomodate prepare phases and PoX sunset
229
+ // set burn_blocks flags to accomodate prepare phases
234
230
for ( i, b) in burn_blocks. iter_mut ( ) . enumerate ( ) {
235
- if sunset_end <= window_start_height + ( i as u64 ) {
236
- // past PoX sunset, so must burn
237
- * b = true ;
238
- } else if burnchain. is_in_prepare_phase ( window_start_height + ( i as u64 ) ) {
231
+ if burnchain. is_in_prepare_phase ( window_start_height + ( i as u64 ) ) {
239
232
// must burn
240
233
* b = true ;
241
234
} else {
@@ -462,40 +455,6 @@ impl Burnchain {
462
455
self . network_id == NETWORK_ID_MAINNET
463
456
}
464
457
465
- /// the expected sunset burn is:
466
- /// total_commit * (progress through sunset phase) / (sunset phase duration)
467
- pub fn expected_sunset_burn ( & self , burn_height : u64 , total_commit : u64 ) -> u64 {
468
- if burn_height < self . pox_constants . sunset_start
469
- || burn_height >= self . pox_constants . sunset_end
470
- {
471
- return 0 ;
472
- }
473
-
474
- // no sunset burn needed in prepare phase -- it's already getting burnt
475
- if self . is_in_prepare_phase ( burn_height) {
476
- return 0 ;
477
- }
478
-
479
- let reward_cycle_height = self . reward_cycle_to_block_height (
480
- self . block_height_to_reward_cycle ( burn_height)
481
- . expect ( "BUG: Sunset start is less than first_block_height" ) ,
482
- ) ;
483
-
484
- if reward_cycle_height <= self . pox_constants . sunset_start {
485
- return 0 ;
486
- }
487
-
488
- let sunset_duration =
489
- ( self . pox_constants . sunset_end - self . pox_constants . sunset_start ) as u128 ;
490
- let sunset_progress = ( reward_cycle_height - self . pox_constants . sunset_start ) as u128 ;
491
-
492
- // use u128 to avoid any possibilities of overflowing in the calculation here.
493
- let expected_u128 = ( total_commit as u128 ) * ( sunset_progress) / sunset_duration;
494
- u64:: try_from ( expected_u128)
495
- // should never be possible, because sunset_burn is <= total_commit, which is a u64
496
- . expect ( "Overflowed u64 in calculating expected sunset_burn" )
497
- }
498
-
499
458
pub fn is_reward_cycle_start ( & self , burn_height : u64 ) -> bool {
500
459
let effective_height = burn_height - self . first_block_height ;
501
460
// first block of the new reward cycle
@@ -743,20 +702,18 @@ impl Burnchain {
743
702
}
744
703
}
745
704
}
746
- x if x == Opcodes :: PreStx as u8 => {
747
- match PreStxOp :: from_tx ( block_header, burn_tx, burnchain. pox_constants . sunset_end ) {
748
- Ok ( op) => Some ( BlockstackOperationType :: PreStx ( op) ) ,
749
- Err ( e) => {
750
- warn ! (
751
- "Failed to parse pre stack stx tx" ;
752
- "txid" => %burn_tx. txid( ) ,
753
- "data" => %to_hex( & burn_tx. data( ) ) ,
754
- "error" => ?e,
755
- ) ;
756
- None
757
- }
705
+ x if x == Opcodes :: PreStx as u8 => match PreStxOp :: from_tx ( block_header, burn_tx) {
706
+ Ok ( op) => Some ( BlockstackOperationType :: PreStx ( op) ) ,
707
+ Err ( e) => {
708
+ warn ! (
709
+ "Failed to parse pre stack stx tx" ;
710
+ "txid" => %burn_tx. txid( ) ,
711
+ "data" => %to_hex( & burn_tx. data( ) ) ,
712
+ "error" => ?e,
713
+ ) ;
714
+ None
758
715
}
759
- }
716
+ } ,
760
717
x if x == Opcodes :: TransferStx as u8 => {
761
718
let pre_stx_txid = TransferStxOp :: get_sender_txid ( burn_tx) . ok ( ) ?;
762
719
let pre_stx_tx = match pre_stx_op_map. get ( & pre_stx_txid) {
@@ -794,12 +751,7 @@ impl Burnchain {
794
751
} ;
795
752
if let Some ( BlockstackOperationType :: PreStx ( pre_stack_stx) ) = pre_stx_tx {
796
753
let sender = & pre_stack_stx. output ;
797
- match StackStxOp :: from_tx (
798
- block_header,
799
- burn_tx,
800
- sender,
801
- burnchain. pox_constants . sunset_end ,
802
- ) {
754
+ match StackStxOp :: from_tx ( block_header, burn_tx, sender) {
803
755
Ok ( op) => Some ( BlockstackOperationType :: StackStx ( op) ) ,
804
756
Err ( e) => {
805
757
warn ! (
@@ -1864,7 +1816,6 @@ pub mod tests {
1864
1816
} ;
1865
1817
1866
1818
let block_commit_1 = LeaderBlockCommitOp {
1867
- sunset_burn : 0 ,
1868
1819
commit_outs : vec ! [ ] ,
1869
1820
block_header_hash : BlockHeaderHash :: from_bytes (
1870
1821
& hex_bytes ( "2222222222222222222222222222222222222222222222222222222222222222" )
@@ -1905,7 +1856,6 @@ pub mod tests {
1905
1856
} ;
1906
1857
1907
1858
let block_commit_2 = LeaderBlockCommitOp {
1908
- sunset_burn : 0 ,
1909
1859
commit_outs : vec ! [ ] ,
1910
1860
block_header_hash : BlockHeaderHash :: from_bytes (
1911
1861
& hex_bytes ( "2222222222222222222222222222222222222222222222222222222222222223" )
@@ -1946,7 +1896,6 @@ pub mod tests {
1946
1896
} ;
1947
1897
1948
1898
let block_commit_3 = LeaderBlockCommitOp {
1949
- sunset_burn : 0 ,
1950
1899
commit_outs : vec ! [ ] ,
1951
1900
block_header_hash : BlockHeaderHash :: from_bytes (
1952
1901
& hex_bytes ( "2222222222222222222222222222222222222222222222222222222222222224" )
@@ -2509,7 +2458,6 @@ pub mod tests {
2509
2458
// insert block commit paired to previous round's leader key, as well as a user burn
2510
2459
if i > 0 {
2511
2460
let next_block_commit = LeaderBlockCommitOp {
2512
- sunset_burn : 0 ,
2513
2461
commit_outs : vec ! [ ] ,
2514
2462
block_header_hash : BlockHeaderHash :: from_bytes ( & vec ! [
2515
2463
i, i, i, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
0 commit comments