aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/chain.h
diff options
context:
space:
mode:
authorAntoine Riard <ariard@student.42.fr>2019-03-26 16:46:22 +0000
committerAntoine Riard <ariard@student.42.fr>2019-03-27 18:29:48 -0400
commit765c0b364d41e9a251c3f88cbe203645854fd790 (patch)
tree6d6daaaba9d8f8f22eddaf4882f5c26db82b71c5 /src/interfaces/chain.h
parent8a8b03ecd2218dcdbcbf3127f2fa94f0f0da4698 (diff)
downloadbitcoin-765c0b364d41e9a251c3f88cbe203645854fd790.tar.xz
refactor: combine Chain::findFirstBlockWithTime/findFirstBlockWithTimeAndHeight
As suggested in #14711, pass height to CChain::FindEarliestAtLeast to simplify Chain interface by combining findFirstBlockWithTime and findFirstBlockWithTimeAndHeight into one Extend findearliestatleast_edge_test in consequence
Diffstat (limited to 'src/interfaces/chain.h')
-rw-r--r--src/interfaces/chain.h17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h
index a9b05f27fc..069d0f7822 100644
--- a/src/interfaces/chain.h
+++ b/src/interfaces/chain.h
@@ -101,20 +101,11 @@ public:
virtual bool haveBlockOnDisk(int height) = 0;
//! Return height of the first block in the chain with timestamp equal
- //! or greater than the given time, or nullopt if there is no block with
- //! a high enough timestamp. Also return the block hash as an optional
- //! output parameter (to avoid the cost of a second lookup in case this
- //! information is needed.)
- virtual Optional<int> findFirstBlockWithTime(int64_t time, uint256* hash) = 0;
-
- //! Return height of the first block in the chain with timestamp equal
//! or greater than the given time and height equal or greater than the
- //! given height, or nullopt if there is no such block.
- //!
- //! Calling this with height 0 is equivalent to calling
- //! findFirstBlockWithTime, but less efficient because it requires a
- //! linear instead of a binary search.
- virtual Optional<int> findFirstBlockWithTimeAndHeight(int64_t time, int height) = 0;
+ //! given height, or nullopt if there is no block with a high enough
+ //! timestamp and height. Also return the block hash as an optional output parameter
+ //! (to avoid the cost of a second lookup in case this information is needed.)
+ virtual Optional<int> findFirstBlockWithTimeAndHeight(int64_t time, int height, uint256* hash) = 0;
//! Return height of last block in the specified range which is pruned, or
//! nullopt if no block in the range is pruned. Range is inclusive.