forked from lthn/blockchain
Merge branch 'master' into final_testnet
This commit is contained in:
commit
12dc720e5f
3 changed files with 11 additions and 3 deletions
|
|
@ -451,7 +451,7 @@ namespace currency
|
|||
m_miner.resume();
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
bool core::handle_block_found(const block& b, block_verification_context* p_verification_result /* = nullptr */)
|
||||
bool core::handle_block_found(const block& b, block_verification_context* p_verification_result, bool need_update_miner_block_template)
|
||||
{
|
||||
TIME_MEASURE_START_MS(time_total_ms);
|
||||
block_verification_context bvc = boost::value_initialized<block_verification_context>();
|
||||
|
|
@ -471,7 +471,8 @@ namespace currency
|
|||
|
||||
//anyway - update miner template
|
||||
TIME_MEASURE_START_MS(time_update_block_template_ms);
|
||||
update_miner_block_template();
|
||||
if (need_update_miner_block_template)
|
||||
update_miner_block_template();
|
||||
TIME_MEASURE_FINISH_MS(time_update_block_template_ms);
|
||||
|
||||
uint64_t time_pack_txs_ms = 0, time_relay_ms = 0;
|
||||
|
|
@ -530,6 +531,11 @@ namespace currency
|
|||
return p_verification_result->m_added_to_main_chain;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
bool core::handle_block_found(const block& b, block_verification_context* p_verification_result /* = nullptr */)
|
||||
{
|
||||
return handle_block_found(b, p_verification_result, true);
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
void core::on_synchronized()
|
||||
{
|
||||
m_miner.on_synchronized();
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ namespace currency
|
|||
i_currency_protocol* get_protocol(){return m_pprotocol;}
|
||||
tx_memory_pool& get_tx_pool(){ return m_mempool; };
|
||||
|
||||
bool handle_block_found(const block& b, block_verification_context* p_verification_result, bool need_update_miner_block_template);
|
||||
|
||||
//-------------------- i_miner_handler -----------------------
|
||||
virtual bool handle_block_found(const block& b, block_verification_context* p_verification_result = nullptr);
|
||||
virtual bool get_block_template(block& b, const account_public_address& adr, const account_public_address& stakeholder_address, wide_difficulty_type& diffic, uint64_t& height, const blobdata& ex_nonce, bool pos = false, const pos_entry& pe = pos_entry());
|
||||
|
|
|
|||
|
|
@ -525,7 +525,7 @@ namespace
|
|||
"nonce: " << nonce << " (0x" << epee::string_tools::pod_to_hex(nonce) << ")", LOG_LEVEL_1);
|
||||
|
||||
block_verification_context bvc = AUTO_VAL_INIT(bvc);
|
||||
r = m_p_core->handle_incoming_block(m_block_template, bvc, false);
|
||||
r = m_p_core->handle_block_found(m_block_template, &bvc, false);
|
||||
if (r)
|
||||
{
|
||||
if (!bvc.m_verification_failed && !bvc.added_to_altchain && bvc.m_added_to_main_chain && !bvc.m_already_exists && !bvc.m_marked_as_orphaned)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue