aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/chain.h
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2019-01-07 23:38:53 -0800
committerRussell Yanofsky <russ@yanofsky.org>2019-01-15 08:42:00 -0800
commitdb21f0264855406c9b6ec4c084a15988c5c71b32 (patch)
tree453f8541449673867736c10f9fd1edd8b53b5476 /src/interfaces/chain.h
parent2ffb07929ef480bd114defdc10b6a84463f222be (diff)
downloadbitcoin-db21f0264855406c9b6ec4c084a15988c5c71b32.tar.xz
Convert CWallet::ScanForWalletTransactions and SyncTransaction to the new Chain apis
Only change in behavior is "Rescan started from block <height>" message replaced by "Rescan started from block <hash>" message in ScanForWalletTransactions. Co-authored-by: Ben Woosley <ben.woosley@gmail.com>
Diffstat (limited to 'src/interfaces/chain.h')
-rw-r--r--src/interfaces/chain.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h
index 8c7bd8c6ea..aef81675e0 100644
--- a/src/interfaces/chain.h
+++ b/src/interfaces/chain.h
@@ -58,6 +58,26 @@ public:
//! will abort.
virtual int64_t getBlockMedianTimePast(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;
+
+ //! 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.
+ virtual Optional<int> findPruned(int start_height = 0, Optional<int> stop_height = nullopt) = 0;
+
//! 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.
//! Also return the height of the specified block as an optional output
@@ -85,6 +105,10 @@ public:
CBlock* block = nullptr,
int64_t* time = nullptr,
int64_t* max_time = nullptr) = 0;
+
+ //! Estimate fraction of total transactions verified if blocks up to
+ //! the specified block hash are verified.
+ virtual double guessVerificationProgress(const uint256& block_hash) = 0;
};
//! Interface to let node manage chain clients (wallets, or maybe tools for