@@ -2001,14 +2001,6 @@ impl NakamotoChainState {
2001
2001
panic ! ( )
2002
2002
} ) ;
2003
2003
2004
- // set stacks block accepted
2005
- let mut sort_tx = sort_db. tx_handle_begin ( canonical_sortition_tip) ?;
2006
- sort_tx. set_stacks_block_accepted (
2007
- & next_ready_block. header . consensus_hash ,
2008
- & next_ready_block. header . block_hash ( ) ,
2009
- next_ready_block. header . chain_length ,
2010
- ) ?;
2011
-
2012
2004
// as a separate transaction, mark this block as processed.
2013
2005
// This is done separately so that the staging blocks DB, which receives writes
2014
2006
// from the network to store blocks, will be available for writes while a block is
@@ -2019,6 +2011,22 @@ impl NakamotoChainState {
2019
2011
2020
2012
let signer_bitvec = ( & next_ready_block) . header . pox_treatment . clone ( ) ;
2021
2013
2014
+ // set stacks block accepted
2015
+ let mut sort_tx = sort_db. tx_handle_begin ( canonical_sortition_tip) ?;
2016
+ sort_tx. set_stacks_block_accepted (
2017
+ & next_ready_block. header . consensus_hash ,
2018
+ & next_ready_block. header . block_hash ( ) ,
2019
+ next_ready_block. header . chain_length ,
2020
+ ) ?;
2021
+
2022
+ sort_tx
2023
+ . commit ( )
2024
+ . unwrap_or_else ( |e| {
2025
+ error ! ( "Failed to commit sortition db transaction after committing chainstate and clarity block. The chainstate database is now corrupted." ;
2026
+ "error" => ?e) ;
2027
+ panic ! ( )
2028
+ } ) ;
2029
+
2022
2030
// announce the block, if we're connected to an event dispatcher
2023
2031
if let Some ( dispatcher) = dispatcher_opt {
2024
2032
let block_event = (
@@ -2045,14 +2053,6 @@ impl NakamotoChainState {
2045
2053
) ;
2046
2054
}
2047
2055
2048
- sort_tx
2049
- . commit ( )
2050
- . unwrap_or_else ( |e| {
2051
- error ! ( "Failed to commit sortition db transaction after committing chainstate and clarity block. The chainstate database is now corrupted." ;
2052
- "error" => ?e) ;
2053
- panic ! ( )
2054
- } ) ;
2055
-
2056
2056
Ok ( Some ( receipt) )
2057
2057
}
2058
2058
0 commit comments