From 6cf8ca2a7f3e11ca5559018dfc9b20869c07cdce Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Tue, 30 Aug 2016 16:39:33 +0100 Subject: 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. --- tests/unit_tests/hardfork.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/unit_tests/hardfork.cpp') diff --git a/tests/unit_tests/hardfork.cpp b/tests/unit_tests/hardfork.cpp index a279b6c68..b3bd47687 100644 --- a/tests/unit_tests/hardfork.cpp +++ b/tests/unit_tests/hardfork.cpp @@ -58,7 +58,7 @@ public: virtual void block_txn_stop() {} virtual void block_txn_abort() {} virtual void drop_hard_fork_info() {} - virtual bool block_exists(const crypto::hash& h) const { return false; } + virtual bool block_exists(const crypto::hash& h, uint64_t *height) const { return false; } virtual block get_block(const crypto::hash& h) const { return block(); } virtual uint64_t get_block_height(const crypto::hash& h) const { return 0; } virtual block_header get_block_header(const crypto::hash& h) const { return block_header(); } -- cgit v1.2.3