diff options
author | MarcoFalke <falke.marco@gmail.com> | 2019-04-19 11:59:56 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2019-04-19 12:03:12 -0400 |
commit | 56376f336548b53cf31e98a58dfb4db22cede6e5 (patch) | |
tree | b8cd60e341fe3fc1aba9322fec5ed51e3288ace3 /src/interfaces/chain.h | |
parent | b6a5583c4f9becbccc4cfb1fb93d190a45cb27ea (diff) | |
parent | 765c0b364d41e9a251c3f88cbe203645854fd790 (diff) |
Merge #15670: refactor: combine Chain::findFirstBlockWithTime/findFirstBlockWithTimeAndHeight
765c0b364d refactor: combine Chain::findFirstBlockWithTime/findFirstBlockWithTimeAndHeight (Antoine Riard)
Pull request description:
As suggested in #14711, pass height to CChain::FindEarliestAtLeast to
simplify Chain interface by combining findFirstBlockWithTime and
findFirstBlockWithTimeAndHeight into one
ACKs for commit 765c0b:
jnewbery:
utACK 765c0b364d41e9a251c3f88cbe203645854fd790. Nice work @ariard!
ryanofsky:
utACK 765c0b364d41e9a251c3f88cbe203645854fd790. Looks good, thanks for implementing the suggestion!
Tree-SHA512: 63f98252a93da95f08c0b6325ea98f717aa9ae4036d17eaa6edbec68e5ddd65672d66a6af267b80c36311fffa9b415a47308e95ea7718b300b685e23d4e9e6ec
Diffstat (limited to 'src/interfaces/chain.h')
-rw-r--r-- | src/interfaces/chain.h | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h index 17d7b6d8f1..180991526b 100644 --- a/src/interfaces/chain.h +++ b/src/interfaces/chain.h @@ -105,20 +105,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. |