mirror of
https://github.com/monero-project/monero.git
synced 2025-07-23 06:20:50 -04:00
core: faster find_blockchain_supplement
Since this queries block heights for blocks that may or may not exist, queries for non existing blocks would throw an exception, and that would slow down the loop a lot. 7 seconds to go through a 30 hash list. Fix this by adding an optional return block height to block_exists and using this instead. Actual errors will still throw an exception. This also cuts down on log exception spam.
This commit is contained in:
parent
c3ba844f03
commit
6cf8ca2a7f
7 changed files with 19 additions and 12 deletions
|
@ -1801,12 +1801,8 @@ bool Blockchain::find_blockchain_supplement(const std::list<crypto::hash>& qbloc
|
|||
{
|
||||
try
|
||||
{
|
||||
split_height = m_db->get_block_height(*bl_it);
|
||||
break;
|
||||
}
|
||||
catch (const BLOCK_DNE& e)
|
||||
{
|
||||
continue;
|
||||
if (m_db->block_exists(*bl_it, &split_height))
|
||||
break;
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue