update_current_blockchain_height() added

pull/5/head
moneroexamples 7 years ago
parent 3d758aa88a
commit 83e7989a99

@ -70,7 +70,7 @@ CurrentBlockchainStatus::start_monitor_blockchain_thread()
{
while (true)
{
current_height = get_current_blockchain_height();
update_current_blockchain_height();
read_mempool();
cout << "Check block height: " << current_height;
cout << " no of mempool txs: " << mempool_txs.size();
@ -105,6 +105,13 @@ CurrentBlockchainStatus::get_current_blockchain_height()
}
void
CurrentBlockchainStatus::update_current_blockchain_height()
{
current_height = get_current_blockchain_height();
}
void
CurrentBlockchainStatus::set_blockchain_path(const string &path)
{

@ -81,6 +81,9 @@ struct CurrentBlockchainStatus
uint64_t
get_current_blockchain_height();
static void
update_current_blockchain_height();
static void
set_blockchain_path(const string &path);

@ -116,8 +116,10 @@ TxSearch::search()
{
cerr << "Cant get block of height: " + to_string(searched_blk_no) << endl;
--searched_blk_no; // just go back one block, and retry
// maybe this was laternative block and got orphaned.
// update of current_height, as maybe top block(s)
// were dropped due to reorganization.
CurrentBlockchainStatus::update_current_blockchain_height();
continue;
}

Loading…
Cancel
Save