@ -139,7 +139,9 @@ Blockchain::Blockchain(tx_memory_pool& tx_pool) :
m_long_term_block_weights_cache_rolling_median ( CRYPTONOTE_LONG_TERM_BLOCK_WEIGHT_WINDOW_SIZE ) ,
m_difficulty_for_next_block_top_hash ( crypto : : null_hash ) ,
m_difficulty_for_next_block ( 1 ) ,
m_btc_valid ( false )
m_btc_valid ( false ) ,
m_batch_success ( true ) ,
m_prepare_height ( 0 )
{
LOG_PRINT_L3 ( " Blockchain:: " < < __func__ ) ;
}
@ -798,6 +800,13 @@ crypto::hash Blockchain::get_block_id_by_height(uint64_t height) const
return null_hash ;
}
//------------------------------------------------------------------
crypto : : hash Blockchain : : get_pending_block_id_by_height ( uint64_t height ) const
{
if ( m_prepare_height & & height > = m_prepare_height & & height - m_prepare_height < m_prepare_nblocks )
return ( * m_prepare_blocks ) [ height - m_prepare_height ] . hash ;
return get_block_id_by_height ( height ) ;
}
//------------------------------------------------------------------
bool Blockchain : : get_block_by_hash ( const crypto : : hash & h , block & blk , bool * orphan ) const
{
LOG_PRINT_L3 ( " Blockchain:: " < < __func__ ) ;
@ -4534,6 +4543,9 @@ bool Blockchain::prepare_handle_incoming_blocks(const std::vector<block_complete
m_blocks_longhash_table . clear ( ) ;
uint64_t thread_height = height ;
tools : : threadpool : : waiter waiter ;
m_prepare_height = height ;
m_prepare_nblocks = blocks_entry . size ( ) ;
m_prepare_blocks = & blocks ;
for ( unsigned int i = 0 ; i < threads ; i + + )
{
unsigned nblocks = batches ;
@ -4544,6 +4556,7 @@ bool Blockchain::prepare_handle_incoming_blocks(const std::vector<block_complete
}
waiter . wait ( & tpool ) ;
m_prepare_height = 0 ;
if ( m_cancel )
return false ;