aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_db/blockchain_db.h
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-08-30 16:39:33 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-08-31 10:03:32 +0100
commit6cf8ca2a7f3e11ca5559018dfc9b20869c07cdce (patch)
tree5634718d7626d234510d1f9e4c714627ff4b8590 /src/blockchain_db/blockchain_db.h
parentMerge pull request #1014 (diff)
downloadmonero-6cf8ca2a7f3e11ca5559018dfc9b20869c07cdce.tar.xz
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.
Diffstat (limited to '')
-rw-r--r--src/blockchain_db/blockchain_db.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/blockchain_db/blockchain_db.h b/src/blockchain_db/blockchain_db.h
index d26080a3b..5b6a793d8 100644
--- a/src/blockchain_db/blockchain_db.h
+++ b/src/blockchain_db/blockchain_db.h
@@ -736,10 +736,11 @@ public:
* @brief checks if a block exists
*
* @param h the hash of the requested block
+ * @param height if non NULL, returns the block's height if found
*
* @return true of the block exists, otherwise false
*/
- virtual bool block_exists(const crypto::hash& h) const = 0;
+ virtual bool block_exists(const crypto::hash& h, uint64_t *height = NULL) const = 0;
/**
* @brief fetches the block with the given hash