aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/scriptpubkeyman.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet/scriptpubkeyman.h')
-rw-r--r--src/wallet/scriptpubkeyman.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/wallet/scriptpubkeyman.h b/src/wallet/scriptpubkeyman.h
index ef74638751..10def20d79 100644
--- a/src/wallet/scriptpubkeyman.h
+++ b/src/wallet/scriptpubkeyman.h
@@ -148,6 +148,12 @@ public:
}
};
+struct WalletDestination
+{
+ CTxDestination dest;
+ std::optional<bool> internal;
+};
+
/*
* 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.
@@ -180,8 +186,14 @@ public:
*/
virtual bool TopUp(unsigned int size = 0) { return false; }
- //! Mark unused addresses as being used
- virtual void MarkUnusedAddresses(const CScript& script) {}
+ /** Mark unused addresses as being used
+ * Affects all keys up to and including the one determined by provided script.
+ *
+ * @param script determines the last key to mark as used
+ *
+ * @return All of the addresses affected
+ */
+ virtual std::vector<WalletDestination> MarkUnusedAddresses(const CScript& script) { return {}; }
/** Sets up the key generation stuff, i.e. generates new HD seeds and sets them as active.
* Returns false if already setup or setup fails, true if setup is successful
@@ -356,7 +368,7 @@ public:
bool TopUp(unsigned int size = 0) override;
- void MarkUnusedAddresses(const CScript& script) override;
+ std::vector<WalletDestination> MarkUnusedAddresses(const CScript& script) override;
//! Upgrade stored CKeyMetadata objects to store key origin info as KeyOriginInfo
void UpgradeKeyMetadata();
@@ -481,9 +493,13 @@ public:
void LearnAllRelatedScripts(const CPubKey& key);
/**
- * Marks all keys in the keypool up to and including reserve_key as used.
+ * Marks all keys in the keypool up to and including the provided key as used.
+ *
+ * @param keypool_id determines the last key to mark as used
+ *
+ * @return All affected keys
*/
- void MarkReserveKeysAsUsed(int64_t keypool_id) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore);
+ std::vector<CKeyPool> MarkReserveKeysAsUsed(int64_t keypool_id) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore);
const std::map<CKeyID, int64_t>& GetAllReserveKeys() const { return m_pool_key_to_index; }
std::set<CKeyID> GetKeys() const override;
@@ -563,7 +579,7 @@ public:
// (with or without private keys), the "keypool" is a single xpub.
bool TopUp(unsigned int size = 0) override;
- void MarkUnusedAddresses(const CScript& script) override;
+ std::vector<WalletDestination> MarkUnusedAddresses(const CScript& script) override;
bool IsHDEnabled() const override;