diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2022-08-23 16:10:59 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2022-10-25 15:57:28 +0200 |
commit | 088e38d3bbea9694b319bc34e0d2e70d210c38b4 (patch) | |
tree | 526394755d33b599c6ee1e1e7a200ab8ace56755 /src/interfaces | |
parent | e7a0e9627196655be5aa6c2738d4b57646a03726 (diff) | |
download | bitcoin-088e38d3bbea9694b319bc34e0d2e70d210c38b4.tar.xz |
add chain interface methods for using BIP 157 block filters
This is useful for speeding up wallet rescans and is based on an
earlier version from PR #15845 ("wallet: Fast rescan with BIP157 block
filters"), which was never merged.
Co-authored-by: MacroFake <falke.marco@gmail.com>
Diffstat (limited to 'src/interfaces')
-rw-r--r-- | src/interfaces/chain.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h index 5fc0e540a9..7a3d88b18f 100644 --- a/src/interfaces/chain.h +++ b/src/interfaces/chain.h @@ -5,6 +5,7 @@ #ifndef BITCOIN_INTERFACES_CHAIN_H #define BITCOIN_INTERFACES_CHAIN_H +#include <blockfilter.h> #include <primitives/transaction.h> // For CTransactionRef #include <util/settings.h> // For util::SettingsValue @@ -143,6 +144,13 @@ public: //! or one of its ancestors. virtual std::optional<int> findLocatorFork(const CBlockLocator& locator) = 0; + //! Returns whether a block filter index is available. + virtual bool hasBlockFilterIndex(BlockFilterType filter_type) = 0; + + //! Returns whether any of the elements match the block via a BIP 157 block filter + //! or std::nullopt if the block filter for this block couldn't be found. + virtual std::optional<bool> blockFilterMatchesAny(BlockFilterType filter_type, const uint256& block_hash, const GCSFilter::ElementSet& filter_set) = 0; + //! Return whether node has the block and optionally return block metadata //! or contents. virtual bool findBlock(const uint256& hash, const FoundBlock& block={}) = 0; |