diff options
author | Howard Chu <hyc@symas.com> | 2017-06-01 13:29:51 +0100 |
---|---|---|
committer | Howard Chu <hyc@symas.com> | 2017-06-01 14:14:24 +0100 |
commit | d17c0fc2d0ae52260a93ec8985b7ebb7ad3cfea7 (patch) | |
tree | 74598f10a771ee39e05778a20d1be805727169e0 /src/blockchain_db/blockchain_db.h | |
parent | Merge pull request #2053 (diff) | |
download | monero-d17c0fc2d0ae52260a93ec8985b7ebb7ad3cfea7.tar.xz |
Don't copy blockchain for coinbase_tx_sum
Changed Blockchain::for_all_blocks() to for_blocks_range()
Operate on blockchain in-place instead of building a copy first.
Diffstat (limited to 'src/blockchain_db/blockchain_db.h')
-rw-r--r-- | src/blockchain_db/blockchain_db.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/blockchain_db/blockchain_db.h b/src/blockchain_db/blockchain_db.h index 9dd343f4b..b0a3d84e1 100644 --- a/src/blockchain_db/blockchain_db.h +++ b/src/blockchain_db/blockchain_db.h @@ -1353,10 +1353,10 @@ public: virtual bool for_all_key_images(std::function<bool(const crypto::key_image&)>) const = 0; /** - * @brief runs a function over all blocks stored + * @brief runs a function over a range of blocks * - * The subclass should run the passed function for each block it has - * stored, passing (block_height, block_hash, block) as its parameters. + * The subclass should run the passed function for each block in the + * specified range, passing (block_height, block_hash, block) as its parameters. * * If any call to the function returns false, the subclass should return * false. Otherwise, the subclass returns true. @@ -1364,11 +1364,13 @@ public: * The subclass should throw DB_ERROR if any of the expected values are * not found. Current implementations simply return false. * + * @param h1 the start height + * @param h2 the end height * @param std::function fn the function to run * * @return false if the function returns false for any block, otherwise true */ - virtual bool for_all_blocks(std::function<bool(uint64_t, const crypto::hash&, const cryptonote::block&)>) const = 0; + virtual bool for_blocks_range(const uint64_t& h1, const uint64_t& h2, std::function<bool(uint64_t, const crypto::hash&, const cryptonote::block&)>) const = 0; /** * @brief runs a function over all transactions stored |