aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/scriptpubkeyman.h
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2019-12-05 15:23:05 -0500
committerAndrew Chow <achow101-github@achow101.com>2020-05-15 18:00:04 -0400
commit45f2f6a0e8514a0438a87554400bf73cbb90707f (patch)
tree979ce45063a88655f050cb2b0f2a31e56b6cca38 /src/wallet/scriptpubkeyman.h
parentb59b4504abf96cec860badfed2ac793ae5d40ced (diff)
downloadbitcoin-45f2f6a0e8514a0438a87554400bf73cbb90707f.tar.xz
Determine inactive HD seeds from key metadata and track them in LegacyScriptPubKeyMan
Diffstat (limited to 'src/wallet/scriptpubkeyman.h')
-rw-r--r--src/wallet/scriptpubkeyman.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/wallet/scriptpubkeyman.h b/src/wallet/scriptpubkeyman.h
index f7b0be4e97..0f43564748 100644
--- a/src/wallet/scriptpubkeyman.h
+++ b/src/wallet/scriptpubkeyman.h
@@ -18,6 +18,8 @@
#include <boost/signals2/signal.hpp>
+#include <unordered_map>
+
enum class OutputType;
// Wallet storage things that ScriptPubKeyMans need in order to be able to store things to the wallet database.
@@ -143,6 +145,17 @@ public:
}
};
+class KeyIDHasher
+{
+public:
+ KeyIDHasher() {}
+
+ size_t operator()(const CKeyID& id) const
+ {
+ return id.GetUint64(0);
+ }
+};
+
/*
* A class implementing ScriptPubKeyMan manages some (or all) scriptPubKeys used in a wallet.
* It contains the scripts and keys related to the scriptPubKeys it manages.
@@ -288,6 +301,7 @@ private:
/* the HD chain data model (external chain counters) */
CHDChain m_hd_chain;
+ std::unordered_map<CKeyID, CHDChain, KeyIDHasher> m_inactive_hd_chains;
/* HD derive new child key (on internal or external chain) */
void DeriveNewChildKey(WalletBatch& batch, CKeyMetadata& metadata, CKey& secret, CHDChain& hd_chain, bool internal = false) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore);
@@ -397,6 +411,7 @@ public:
/* Set the HD chain model (chain child index counters) */
void SetHDChain(const CHDChain& chain, bool memonly);
const CHDChain& GetHDChain() const { return m_hd_chain; }
+ void AddInactiveHDChain(const CHDChain& chain);
//! Adds a watch-only address to the store, without saving it to disk (used by LoadWallet)
bool LoadWatchOnly(const CScript &dest);