diff options
author | Andrew Chow <achow101-github@achow101.com> | 2020-08-25 13:10:32 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2020-08-25 13:23:40 -0400 |
commit | 544e12a4e81633d222574eec253a1ff292d3c4a5 (patch) | |
tree | d19b99594f9609df1370bdd95941f8d2a1d2a54d /src/wallet/walletdb.h | |
parent | f8462a6d2794be728cf8550f45d19a354aae59cf (diff) | |
download | bitcoin-544e12a4e81633d222574eec253a1ff292d3c4a5.tar.xz |
walletdb: Add KeyFilterFn to ReadKeyValue
Add a KeyFilterFn callback to ReadKeyValue which allows the caller to
specify which types to actually deserialize. A KeyFilterFn takes the
type as the parameter and returns a bool indicating whether
deserialization should continue.
Diffstat (limited to 'src/wallet/walletdb.h')
-rw-r--r-- | src/wallet/walletdb.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/wallet/walletdb.h b/src/wallet/walletdb.h index 64d60b1f44..eaeb2bb863 100644 --- a/src/wallet/walletdb.h +++ b/src/wallet/walletdb.h @@ -280,8 +280,11 @@ private: //! Compacts BDB state so that wallet.dat is self-contained (if there are changes) void MaybeCompactWalletDB(); +//! Callback for filtering key types to deserialize in ReadKeyValue +using KeyFilterFn = std::function<bool(const std::string&)>; + //! Unserialize a given Key-Value pair and load it into the wallet -bool ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, std::string& strType, std::string& strErr); +bool ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue, std::string& strType, std::string& strErr, const KeyFilterFn& filter_fn = nullptr); /** Return whether a wallet database is currently loaded. */ bool IsWalletLoaded(const fs::path& wallet_path); |