Changeset View
Changeset View
Standalone View
Standalone View
src/interfaces/chain.h
Show First 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | public: | ||||
//! will abort. | //! will abort. | ||||
virtual int64_t getBlockMedianTimePast(int height) = 0; | virtual int64_t getBlockMedianTimePast(int height) = 0; | ||||
//! Check that the block is available on disk (i.e. has not been | //! Check that the block is available on disk (i.e. has not been | ||||
//! pruned), and contains transactions. | //! pruned), and contains transactions. | ||||
virtual bool haveBlockOnDisk(int height) = 0; | virtual bool haveBlockOnDisk(int height) = 0; | ||||
//! Return height of the first block in the chain with timestamp equal | //! 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 | //! or greater than the given time and height equal or greater than the | ||||
//! a high enough timestamp. Also return the block hash as an optional | //! 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 | //! output parameter (to avoid the cost of a second lookup in case this | ||||
//! information is needed.) | //! information is needed.) | ||||
virtual Optional<int> findFirstBlockWithTime(int64_t time, | virtual Optional<int> | ||||
findFirstBlockWithTimeAndHeight(int64_t time, int height, | |||||
BlockHash *hash) = 0; | BlockHash *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; | |||||
//! Return height of last block in the specified range which is pruned, | //! 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. | //! or nullopt if no block in the range is pruned. Range is inclusive. | ||||
virtual Optional<int> | virtual Optional<int> | ||||
findPruned(int start_height = 0, | findPruned(int start_height = 0, | ||||
Optional<int> stop_height = nullopt) = 0; | Optional<int> stop_height = nullopt) = 0; | ||||
//! Return height of the highest block on the chain that is an ancestor | //! Return height of the highest block on the chain that is an ancestor | ||||
//! of the specified block, or nullopt if no common ancestor is found. | //! of the specified block, or nullopt if no common ancestor is found. | ||||
▲ Show 20 Lines • Show All 208 Lines • Show Last 20 Lines |