Bitcoin Core  27.99.0
P2P Digital Currency
scriptpubkeyman.h
Go to the documentation of this file.
1 // Copyright (c) 2019-2022 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_WALLET_SCRIPTPUBKEYMAN_H
6 #define BITCOIN_WALLET_SCRIPTPUBKEYMAN_H
7 
8 #include <addresstype.h>
9 #include <logging.h>
10 #include <psbt.h>
11 #include <script/descriptor.h>
12 #include <script/script.h>
13 #include <script/signingprovider.h>
14 #include <util/error.h>
15 #include <util/message.h>
16 #include <util/result.h>
17 #include <util/time.h>
18 #include <wallet/crypter.h>
19 #include <wallet/types.h>
20 #include <wallet/walletdb.h>
21 #include <wallet/walletutil.h>
22 
23 #include <boost/signals2/signal.hpp>
24 
25 #include <functional>
26 #include <optional>
27 #include <unordered_map>
28 
29 enum class OutputType;
30 
31 namespace wallet {
32 struct MigrationData;
33 class ScriptPubKeyMan;
34 
35 // Wallet storage things that ScriptPubKeyMans need in order to be able to store things to the wallet database.
36 // It provides access to things that are part of the entire wallet and not specific to a ScriptPubKeyMan such as
37 // wallet flags, wallet version, encryption keys, encryption status, and the database itself. This allows a
38 // ScriptPubKeyMan to have callbacks into CWallet without causing a circular dependency.
39 // WalletStorage should be the same for all ScriptPubKeyMans of a wallet.
41 {
42 public:
43  virtual ~WalletStorage() = default;
44  virtual std::string GetDisplayName() const = 0;
45  virtual WalletDatabase& GetDatabase() const = 0;
46  virtual bool IsWalletFlagSet(uint64_t) const = 0;
47  virtual void UnsetBlankWalletFlag(WalletBatch&) = 0;
48  virtual bool CanSupportFeature(enum WalletFeature) const = 0;
49  virtual void SetMinVersion(enum WalletFeature, WalletBatch* = nullptr) = 0;
51  virtual bool WithEncryptionKey(std::function<bool (const CKeyingMaterial&)> cb) const = 0;
52  virtual bool HasEncryptionKeys() const = 0;
53  virtual bool IsLocked() const = 0;
55  virtual void TopUpCallback(const std::set<CScript>&, ScriptPubKeyMan*) = 0;
56 };
57 
59 static constexpr int64_t UNKNOWN_TIME = std::numeric_limits<int64_t>::max();
60 
62 static const unsigned int DEFAULT_KEYPOOL_SIZE = 1000;
63 
64 std::vector<CKeyID> GetAffectedKeys(const CScript& spk, const SigningProvider& provider);
65 
115 class CKeyPool
116 {
117 public:
119  int64_t nTime;
123  bool fInternal;
126 
127  CKeyPool();
128  CKeyPool(const CPubKey& vchPubKeyIn, bool internalIn);
129 
130  template<typename Stream>
131  void Serialize(Stream& s) const
132  {
133  s << int{259900}; // Unused field, writes the highest client version ever written
134  s << nTime << vchPubKey << fInternal << m_pre_split;
135  }
136 
137  template<typename Stream>
138  void Unserialize(Stream& s)
139  {
140  s >> int{}; // Discard unused field
141  s >> nTime >> vchPubKey;
142  try {
143  s >> fInternal;
144  } catch (std::ios_base::failure&) {
145  /* flag as external address if we can't read the internal boolean
146  (this will be the case for any wallet before the HD chain split version) */
147  fInternal = false;
148  }
149  try {
150  s >> m_pre_split;
151  } catch (std::ios_base::failure&) {
152  /* flag as postsplit address if we can't read the m_pre_split boolean
153  (this will be the case for any wallet that upgrades to HD chain split) */
154  m_pre_split = false;
155  }
156  }
157 };
158 
160 {
162  std::optional<bool> internal;
163 };
164 
165 /*
166  * A class implementing ScriptPubKeyMan manages some (or all) scriptPubKeys used in a wallet.
167  * It contains the scripts and keys related to the scriptPubKeys it manages.
168  * A ScriptPubKeyMan will be able to give out scriptPubKeys to be used, as well as marking
169  * when a scriptPubKey has been used. It also handles when and how to store a scriptPubKey
170  * and its related scripts and keys, including encryption.
171  */
173 {
174 protected:
176 
177 public:
178  explicit ScriptPubKeyMan(WalletStorage& storage) : m_storage(storage) {}
179  virtual ~ScriptPubKeyMan() {};
180  virtual util::Result<CTxDestination> GetNewDestination(const OutputType type) { return util::Error{Untranslated("Not supported")}; }
181  virtual isminetype IsMine(const CScript& script) const { return ISMINE_NO; }
182 
184  virtual bool CheckDecryptionKey(const CKeyingMaterial& master_key) { return false; }
185  virtual bool Encrypt(const CKeyingMaterial& master_key, WalletBatch* batch) { return false; }
186 
187  virtual util::Result<CTxDestination> GetReservedDestination(const OutputType type, bool internal, int64_t& index, CKeyPool& keypool) { return util::Error{Untranslated("Not supported")}; }
188  virtual void KeepDestination(int64_t index, const OutputType& type) {}
189  virtual void ReturnDestination(int64_t index, bool internal, const CTxDestination& addr) {}
190 
195  virtual bool TopUp(unsigned int size = 0) { return false; }
196 
204  virtual std::vector<WalletDestination> MarkUnusedAddresses(const CScript& script) { return {}; }
205 
210  virtual bool SetupGeneration(bool force = false) { return false; }
211 
212  /* Returns true if HD is enabled */
213  virtual bool IsHDEnabled() const { return false; }
214 
215  /* Returns true if the wallet can give out new addresses. This means it has keys in the keypool or can generate new keys */
216  virtual bool CanGetAddresses(bool internal = false) const { return false; }
217 
219  virtual bool Upgrade(int prev_version, int new_version, bilingual_str& error) { return true; }
220 
221  virtual bool HavePrivateKeys() const { return false; }
222 
224  virtual void RewriteDB() {}
225 
226  virtual std::optional<int64_t> GetOldestKeyPoolTime() const { return GetTime(); }
227 
228  virtual unsigned int GetKeyPoolSize() const { return 0; }
229 
230  virtual int64_t GetTimeFirstKey() const { return 0; }
231 
232  virtual std::unique_ptr<CKeyMetadata> GetMetadata(const CTxDestination& dest) const { return nullptr; }
233 
234  virtual std::unique_ptr<SigningProvider> GetSolvingProvider(const CScript& script) const { return nullptr; }
235 
239  virtual bool CanProvide(const CScript& script, SignatureData& sigdata) { return false; }
240 
242  virtual bool SignTransaction(CMutableTransaction& tx, const std::map<COutPoint, Coin>& coins, int sighash, std::map<int, bilingual_str>& input_errors) const { return false; }
244  virtual SigningResult SignMessage(const std::string& message, const PKHash& pkhash, std::string& str_sig) const { return SigningResult::SIGNING_FAILED; };
246  virtual TransactionError FillPSBT(PartiallySignedTransaction& psbt, const PrecomputedTransactionData& txdata, int sighash_type = SIGHASH_DEFAULT, bool sign = true, bool bip32derivs = false, int* n_signed = nullptr, bool finalize = true) const { return TransactionError::INVALID_PSBT; }
247 
248  virtual uint256 GetID() const { return uint256(); }
249 
251  virtual std::unordered_set<CScript, SaltedSipHasher> GetScriptPubKeys() const { return {}; };
252 
254  template <typename... Params>
255  void WalletLogPrintf(const char* fmt, Params... parameters) const
256  {
257  LogPrintf(("%s " + std::string{fmt}).c_str(), m_storage.GetDisplayName(), parameters...);
258  };
259 
261  boost::signals2::signal<void (bool fHaveWatchOnly)> NotifyWatchonlyChanged;
262 
264  boost::signals2::signal<void ()> NotifyCanGetAddressesChanged;
265 
267  boost::signals2::signal<void (const ScriptPubKeyMan* spkm, int64_t new_birth_time)> NotifyFirstKeyTimeChanged;
268 };
269 
271 static const std::unordered_set<OutputType> LEGACY_OUTPUT_TYPES {
275 };
276 
277 class DescriptorScriptPubKeyMan;
278 
280 {
281 private:
284 
285  using WatchOnlySet = std::set<CScript>;
286  using WatchKeyMap = std::map<CKeyID, CPubKey>;
287 
288  WalletBatch *encrypted_batch GUARDED_BY(cs_KeyStore) = nullptr;
289 
290  using CryptedKeyMap = std::map<CKeyID, std::pair<CPubKey, std::vector<unsigned char>>>;
291 
295 
296  // By default, do not scan any block until keys/scripts are generated/imported
297  int64_t nTimeFirstKey GUARDED_BY(cs_KeyStore) = UNKNOWN_TIME;
298 
300  int64_t m_keypool_size GUARDED_BY(cs_KeyStore){DEFAULT_KEYPOOL_SIZE};
301 
302  bool AddKeyPubKeyInner(const CKey& key, const CPubKey &pubkey);
303  bool AddCryptedKeyInner(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret);
304 
316  bool AddWatchOnlyInMem(const CScript &dest);
318  bool AddWatchOnlyWithDB(WalletBatch &batch, const CScript& dest, int64_t create_time) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore);
319 
321  bool AddKeyPubKeyWithDB(WalletBatch &batch,const CKey& key, const CPubKey &pubkey) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore);
322 
323  void AddKeypoolPubkeyWithDB(const CPubKey& pubkey, const bool internal, WalletBatch& batch);
324 
326  bool AddCScriptWithDB(WalletBatch& batch, const CScript& script);
327 
329  bool AddKeyOriginWithDB(WalletBatch& batch, const CPubKey& pubkey, const KeyOriginInfo& info);
330 
331  /* the HD chain data model (external chain counters) */
333  std::unordered_map<CKeyID, CHDChain, SaltedSipHasher> m_inactive_hd_chains;
334 
335  /* HD derive new child key (on internal or external chain) */
336  void DeriveNewChildKey(WalletBatch& batch, CKeyMetadata& metadata, CKey& secret, CHDChain& hd_chain, bool internal = false) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore);
337 
338  std::set<int64_t> setInternalKeyPool GUARDED_BY(cs_KeyStore);
339  std::set<int64_t> setExternalKeyPool GUARDED_BY(cs_KeyStore);
340  std::set<int64_t> set_pre_split_keypool GUARDED_BY(cs_KeyStore);
341  int64_t m_max_keypool_index GUARDED_BY(cs_KeyStore) = 0;
343  // Tracks keypool indexes to CKeyIDs of keys that have been taken out of the keypool but may be returned to it
345 
347  bool GetKeyFromPool(CPubKey &key, const OutputType type);
348 
363  bool ReserveKeyFromKeyPool(int64_t& nIndex, CKeyPool& keypool, bool fRequestedInternal);
364 
375  bool TopUpInactiveHDChain(const CKeyID seed_id, int64_t index, bool internal);
376 
377  bool TopUpChain(WalletBatch& batch, CHDChain& chain, unsigned int size);
378 public:
379  LegacyScriptPubKeyMan(WalletStorage& storage, int64_t keypool_size) : ScriptPubKeyMan(storage), m_keypool_size(keypool_size) {}
380 
382  isminetype IsMine(const CScript& script) const override;
383 
384  bool CheckDecryptionKey(const CKeyingMaterial& master_key) override;
385  bool Encrypt(const CKeyingMaterial& master_key, WalletBatch* batch) override;
386 
387  util::Result<CTxDestination> GetReservedDestination(const OutputType type, bool internal, int64_t& index, CKeyPool& keypool) override;
388  void KeepDestination(int64_t index, const OutputType& type) override;
389  void ReturnDestination(int64_t index, bool internal, const CTxDestination&) override;
390 
391  bool TopUp(unsigned int size = 0) override;
392 
393  std::vector<WalletDestination> MarkUnusedAddresses(const CScript& script) override;
394 
396  void UpgradeKeyMetadata();
397 
398  bool IsHDEnabled() const override;
399 
400  bool SetupGeneration(bool force = false) override;
401 
402  bool Upgrade(int prev_version, int new_version, bilingual_str& error) override;
403 
404  bool HavePrivateKeys() const override;
405 
406  void RewriteDB() override;
407 
408  std::optional<int64_t> GetOldestKeyPoolTime() const override;
409  size_t KeypoolCountExternalKeys() const;
410  unsigned int GetKeyPoolSize() const override;
411 
412  int64_t GetTimeFirstKey() const override;
413 
414  std::unique_ptr<CKeyMetadata> GetMetadata(const CTxDestination& dest) const override;
415 
416  bool CanGetAddresses(bool internal = false) const override;
417 
418  std::unique_ptr<SigningProvider> GetSolvingProvider(const CScript& script) const override;
419 
420  bool CanProvide(const CScript& script, SignatureData& sigdata) override;
421 
422  bool SignTransaction(CMutableTransaction& tx, const std::map<COutPoint, Coin>& coins, int sighash, std::map<int, bilingual_str>& input_errors) const override;
423  SigningResult SignMessage(const std::string& message, const PKHash& pkhash, std::string& str_sig) const override;
424  TransactionError FillPSBT(PartiallySignedTransaction& psbt, const PrecomputedTransactionData& txdata, int sighash_type = SIGHASH_DEFAULT, bool sign = true, bool bip32derivs = false, int* n_signed = nullptr, bool finalize = true) const override;
425 
426  uint256 GetID() const override;
427 
428  // Map from Key ID to key metadata.
429  std::map<CKeyID, CKeyMetadata> mapKeyMetadata GUARDED_BY(cs_KeyStore);
430 
431  // Map from Script ID to key metadata (for watch-only keys).
432  std::map<CScriptID, CKeyMetadata> m_script_metadata GUARDED_BY(cs_KeyStore);
433 
435  bool AddKeyPubKey(const CKey& key, const CPubKey &pubkey) override;
437  bool LoadKey(const CKey& key, const CPubKey &pubkey);
439  bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret);
441  bool LoadCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret, bool checksum_valid);
442  void UpdateTimeFirstKey(int64_t nCreateTime) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore);
444  bool LoadCScript(const CScript& redeemScript);
446  void LoadKeyMetadata(const CKeyID& keyID, const CKeyMetadata &metadata);
447  void LoadScriptMetadata(const CScriptID& script_id, const CKeyMetadata &metadata);
449  CPubKey GenerateNewKey(WalletBatch& batch, CHDChain& hd_chain, bool internal = false) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore);
450 
451  /* Set the HD chain model (chain child index counters) and writes it to the database */
452  void AddHDChain(const CHDChain& chain);
454  void LoadHDChain(const CHDChain& chain);
455  const CHDChain& GetHDChain() const { return m_hd_chain; }
456  void AddInactiveHDChain(const CHDChain& chain);
457 
459  bool LoadWatchOnly(const CScript &dest);
461  bool HaveWatchOnly(const CScript &dest) const;
463  bool HaveWatchOnly() const;
465  bool RemoveWatchOnly(const CScript &dest);
466  bool AddWatchOnly(const CScript& dest, int64_t nCreateTime) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore);
467 
469  bool GetWatchPubKey(const CKeyID &address, CPubKey &pubkey_out) const;
470 
471  /* SigningProvider overrides */
472  bool HaveKey(const CKeyID &address) const override;
473  bool GetKey(const CKeyID &address, CKey& keyOut) const override;
474  bool GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const override;
475  bool AddCScript(const CScript& redeemScript) override;
476  bool GetKeyOrigin(const CKeyID& keyid, KeyOriginInfo& info) const override;
477 
479  void LoadKeyPool(int64_t nIndex, const CKeyPool &keypool);
480  bool NewKeyPool();
482 
483  bool ImportScripts(const std::set<CScript> scripts, int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore);
484  bool ImportPrivKeys(const std::map<CKeyID, CKey>& privkey_map, const int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore);
485  bool ImportPubKeys(const std::vector<CKeyID>& ordered_pubkeys, const std::map<CKeyID, CPubKey>& pubkey_map, const std::map<CKeyID, std::pair<CPubKey, KeyOriginInfo>>& key_origins, const bool add_keypool, const bool internal, const int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore);
486  bool ImportScriptPubKeys(const std::set<CScript>& script_pub_keys, const bool have_solving_data, const int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore);
487 
488  /* Returns true if the wallet can generate new keys */
489  bool CanGenerateKeys() const;
490 
491  /* Generates a new HD seed (will not be activated) */
493 
494  /* Derives a new HD seed (will not be activated) */
495  CPubKey DeriveNewSeed(const CKey& key);
496 
497  /* Set the current HD seed (will reset the chain child index counters)
498  Sets the seed's version based on the current wallet version (so the
499  caller must ensure the current wallet version is correct before calling
500  this function). */
501  void SetHDSeed(const CPubKey& key);
502 
509  void LearnRelatedScripts(const CPubKey& key, OutputType);
510 
515  void LearnAllRelatedScripts(const CPubKey& key);
516 
525  const std::map<CKeyID, int64_t>& GetAllReserveKeys() const { return m_pool_key_to_index; }
526 
527  std::set<CKeyID> GetKeys() const override;
528  std::unordered_set<CScript, SaltedSipHasher> GetScriptPubKeys() const override;
529 
534  std::unordered_set<CScript, SaltedSipHasher> GetNotMineScriptPubKeys() const;
535 
538  std::optional<MigrationData> MigrateToDescriptor();
540  bool DeleteRecords();
541 };
542 
545 {
546 private:
548 public:
549  explicit LegacySigningProvider(const LegacyScriptPubKeyMan& spk_man) : m_spk_man(spk_man) {}
550 
551  bool GetCScript(const CScriptID &scriptid, CScript& script) const override { return m_spk_man.GetCScript(scriptid, script); }
552  bool HaveCScript(const CScriptID &scriptid) const override { return m_spk_man.HaveCScript(scriptid); }
553  bool GetPubKey(const CKeyID &address, CPubKey& pubkey) const override { return m_spk_man.GetPubKey(address, pubkey); }
554  bool GetKey(const CKeyID &address, CKey& key) const override { return false; }
555  bool HaveKey(const CKeyID &address) const override { return false; }
556  bool GetKeyOrigin(const CKeyID& keyid, KeyOriginInfo& info) const override { return m_spk_man.GetKeyOrigin(keyid, info); }
557 };
558 
560 {
561 private:
562  using ScriptPubKeyMap = std::map<CScript, int32_t>; // Map of scripts to descriptor range index
563  using PubKeyMap = std::map<CPubKey, int32_t>; // Map of pubkeys involved in scripts to descriptor range index
564  using CryptedKeyMap = std::map<CKeyID, std::pair<CPubKey, std::vector<unsigned char>>>;
565  using KeyMap = std::map<CKeyID, CKey>;
566 
567  ScriptPubKeyMap m_map_script_pub_keys GUARDED_BY(cs_desc_man);
569  int32_t m_max_cached_index = -1;
570 
572  CryptedKeyMap m_map_crypted_keys GUARDED_BY(cs_desc_man);
573 
576 
578  int64_t m_keypool_size GUARDED_BY(cs_desc_man){DEFAULT_KEYPOOL_SIZE};
579 
580  bool AddDescriptorKeyWithDB(WalletBatch& batch, const CKey& key, const CPubKey &pubkey) EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man);
581 
583 
584  // Cached FlatSigningProviders to avoid regenerating them each time they are needed.
586  // Fetch the SigningProvider for the given script and optionally include private keys
587  std::unique_ptr<FlatSigningProvider> GetSigningProvider(const CScript& script, bool include_private = false) const;
588  // Fetch the SigningProvider for the given pubkey and always include private keys. This should only be called by signing code.
589  std::unique_ptr<FlatSigningProvider> GetSigningProvider(const CPubKey& pubkey) const;
590  // Fetch the SigningProvider for a given index and optionally include private keys. Called by the above functions.
591  std::unique_ptr<FlatSigningProvider> GetSigningProvider(int32_t index, bool include_private = false) const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man);
592 
593 protected:
595 
597  bool TopUpWithDB(WalletBatch& batch, unsigned int size = 0);
598 
599 public:
600  DescriptorScriptPubKeyMan(WalletStorage& storage, WalletDescriptor& descriptor, int64_t keypool_size)
601  : ScriptPubKeyMan(storage),
602  m_keypool_size(keypool_size),
603  m_wallet_descriptor(descriptor)
604  {}
605  DescriptorScriptPubKeyMan(WalletStorage& storage, int64_t keypool_size)
606  : ScriptPubKeyMan(storage),
607  m_keypool_size(keypool_size)
608  {}
609 
611 
613  isminetype IsMine(const CScript& script) const override;
614 
615  bool CheckDecryptionKey(const CKeyingMaterial& master_key) override;
616  bool Encrypt(const CKeyingMaterial& master_key, WalletBatch* batch) override;
617 
618  util::Result<CTxDestination> GetReservedDestination(const OutputType type, bool internal, int64_t& index, CKeyPool& keypool) override;
619  void ReturnDestination(int64_t index, bool internal, const CTxDestination& addr) override;
620 
621  // Tops up the descriptor cache and m_map_script_pub_keys. The cache is stored in the wallet file
622  // and is used to expand the descriptor in GetNewDestination. DescriptorScriptPubKeyMan relies
623  // more on ephemeral data than LegacyScriptPubKeyMan. For wallets using unhardened derivation
624  // (with or without private keys), the "keypool" is a single xpub.
625  bool TopUp(unsigned int size = 0) override;
626 
627  std::vector<WalletDestination> MarkUnusedAddresses(const CScript& script) override;
628 
629  bool IsHDEnabled() const override;
630 
632  bool SetupDescriptorGeneration(WalletBatch& batch, const CExtKey& master_key, OutputType addr_type, bool internal);
633 
634  bool HavePrivateKeys() const override;
635  bool HasPrivKey(const CKeyID& keyid) const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man);
637  std::optional<CKey> GetKey(const CKeyID& keyid) const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man);
638 
639  std::optional<int64_t> GetOldestKeyPoolTime() const override;
640  unsigned int GetKeyPoolSize() const override;
641 
642  int64_t GetTimeFirstKey() const override;
643 
644  std::unique_ptr<CKeyMetadata> GetMetadata(const CTxDestination& dest) const override;
645 
646  bool CanGetAddresses(bool internal = false) const override;
647 
648  std::unique_ptr<SigningProvider> GetSolvingProvider(const CScript& script) const override;
649 
650  bool CanProvide(const CScript& script, SignatureData& sigdata) override;
651 
652  bool SignTransaction(CMutableTransaction& tx, const std::map<COutPoint, Coin>& coins, int sighash, std::map<int, bilingual_str>& input_errors) const override;
653  SigningResult SignMessage(const std::string& message, const PKHash& pkhash, std::string& str_sig) const override;
654  TransactionError FillPSBT(PartiallySignedTransaction& psbt, const PrecomputedTransactionData& txdata, int sighash_type = SIGHASH_DEFAULT, bool sign = true, bool bip32derivs = false, int* n_signed = nullptr, bool finalize = true) const override;
655 
656  uint256 GetID() const override;
657 
658  void SetCache(const DescriptorCache& cache);
659 
660  bool AddKey(const CKeyID& key_id, const CKey& key);
661  bool AddCryptedKey(const CKeyID& key_id, const CPubKey& pubkey, const std::vector<unsigned char>& crypted_key);
662 
663  bool HasWalletDescriptor(const WalletDescriptor& desc) const;
664  void UpdateWalletDescriptor(WalletDescriptor& descriptor);
665  bool CanUpdateToWalletDescriptor(const WalletDescriptor& descriptor, std::string& error);
666  void AddDescriptorKey(const CKey& key, const CPubKey &pubkey);
667  void WriteDescriptor();
668 
670  std::unordered_set<CScript, SaltedSipHasher> GetScriptPubKeys() const override;
671  std::unordered_set<CScript, SaltedSipHasher> GetScriptPubKeys(int32_t minimum_index) const;
672  int32_t GetEndRange() const;
673 
674  [[nodiscard]] bool GetDescriptorString(std::string& out, const bool priv) const;
675 
676  void UpgradeDescriptorCache();
677 };
678 
681 {
683  std::vector<std::pair<std::string, int64_t>> watch_descs;
684  std::vector<std::pair<std::string, int64_t>> solvable_descs;
685  std::vector<std::unique_ptr<DescriptorScriptPubKeyMan>> desc_spkms;
686  std::shared_ptr<CWallet> watchonly_wallet{nullptr};
687  std::shared_ptr<CWallet> solvable_wallet{nullptr};
688 };
689 
690 } // namespace wallet
691 
692 #endif // BITCOIN_WALLET_SCRIPTPUBKEYMAN_H
std::variant< CNoDestination, PubKeyDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script categorized into standard templates.
Definition: addresstype.h:131
const CChainParams & Params()
Return the currently selected parameters.
An encapsulated private key.
Definition: key.h:33
A reference to a CKey: the Hash160 of its serialized public key.
Definition: pubkey.h:24
An encapsulated public key.
Definition: pubkey.h:34
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:414
A reference to a CScript: the Hash160 of its serialization.
Definition: script.h:583
Cache for single descriptor's derived extended pubkeys.
Definition: descriptor.h:19
Fillable signing provider that keeps keys in an address->secret map.
virtual bool GetCScript(const CScriptID &hash, CScript &redeemScriptOut) const override
virtual bool HaveCScript(const CScriptID &hash) const override
RecursiveMutex cs_KeyStore
An interface to be implemented by keystores that support signing.
256-bit opaque blob.
Definition: uint256.h:106
A key from a CWallet's keypool.
void Unserialize(Stream &s)
int64_t nTime
The time at which the key was generated. Set in AddKeypoolPubKeyWithDB.
CPubKey vchPubKey
The public key.
void Serialize(Stream &s) const
bool fInternal
Whether this keypool entry is in the internal keypool (for change outputs)
bool m_pre_split
Whether this key was generated for a keypool before the wallet was upgraded to HD-split.
KeyMap GetKeys() const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man)
void SetCache(const DescriptorCache &cache)
std::map< int32_t, FlatSigningProvider > m_map_signing_providers
bool CanProvide(const CScript &script, SignatureData &sigdata) override
Whether this ScriptPubKeyMan can provide a SigningProvider (via GetSolvingProvider) that,...
bool SignTransaction(CMutableTransaction &tx, const std::map< COutPoint, Coin > &coins, int sighash, std::map< int, bilingual_str > &input_errors) const override
Creates new signatures and adds them to the transaction.
std::unordered_set< CScript, SaltedSipHasher > GetScriptPubKeys() const override
Returns a set of all the scriptPubKeys that this ScriptPubKeyMan watches.
WalletDescriptor GetWalletDescriptor() const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man)
std::map< CScript, int32_t > ScriptPubKeyMap
std::optional< CKey > GetKey(const CKeyID &keyid) const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man)
Retrieve the particular key if it is available. Returns nullopt if the key is not in the wallet,...
bool AddCryptedKey(const CKeyID &key_id, const CPubKey &pubkey, const std::vector< unsigned char > &crypted_key)
bool SetupDescriptorGeneration(WalletBatch &batch, const CExtKey &master_key, OutputType addr_type, bool internal)
Setup descriptors based on the given CExtkey.
bool TopUp(unsigned int size=0) override
Fills internal address pool.
bool m_decryption_thoroughly_checked
keeps track of whether Unlock has run a thorough check before
std::map< CKeyID, CKey > KeyMap
unsigned int GetKeyPoolSize() const override
int64_t GetTimeFirstKey() const override
std::unique_ptr< FlatSigningProvider > GetSigningProvider(const CScript &script, bool include_private=false) const
std::map< CPubKey, int32_t > PubKeyMap
bool CheckDecryptionKey(const CKeyingMaterial &master_key) override
Check that the given decryption key is valid for this ScriptPubKeyMan, i.e. it decrypts all of the ke...
bool CanGetAddresses(bool internal=false) const override
ScriptPubKeyMap m_map_script_pub_keys GUARDED_BY(cs_desc_man)
bool CanUpdateToWalletDescriptor(const WalletDescriptor &descriptor, std::string &error)
bool GetDescriptorString(std::string &out, const bool priv) const
std::unique_ptr< CKeyMetadata > GetMetadata(const CTxDestination &dest) const override
util::Result< CTxDestination > GetReservedDestination(const OutputType type, bool internal, int64_t &index, CKeyPool &keypool) override
void AddDescriptorKey(const CKey &key, const CPubKey &pubkey)
std::unique_ptr< SigningProvider > GetSolvingProvider(const CScript &script) const override
DescriptorScriptPubKeyMan(WalletStorage &storage, int64_t keypool_size)
int64_t m_keypool_size GUARDED_BY(cs_desc_man)
Number of pre-generated keys/scripts (part of the look-ahead process, used to detect payments)
bool AddKey(const CKeyID &key_id, const CKey &key)
PubKeyMap m_map_pubkeys GUARDED_BY(cs_desc_man)
bool TopUpWithDB(WalletBatch &batch, unsigned int size=0)
Same as 'TopUp' but designed for use within a batch transaction context.
void ReturnDestination(int64_t index, bool internal, const CTxDestination &addr) override
std::vector< WalletDestination > MarkUnusedAddresses(const CScript &script) override
Mark unused addresses as being used Affects all keys up to and including the one determined by provid...
CryptedKeyMap m_map_crypted_keys GUARDED_BY(cs_desc_man)
bool AddDescriptorKeyWithDB(WalletBatch &batch, const CKey &key, const CPubKey &pubkey) EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man)
bool HasWalletDescriptor(const WalletDescriptor &desc) const
void UpdateWalletDescriptor(WalletDescriptor &descriptor)
std::optional< int64_t > GetOldestKeyPoolTime() const override
SigningResult SignMessage(const std::string &message, const PKHash &pkhash, std::string &str_sig) const override
Sign a message with the given script.
util::Result< CTxDestination > GetNewDestination(const OutputType type) override
TransactionError FillPSBT(PartiallySignedTransaction &psbt, const PrecomputedTransactionData &txdata, int sighash_type=SIGHASH_DEFAULT, bool sign=true, bool bip32derivs=false, int *n_signed=nullptr, bool finalize=true) const override
Adds script and derivation path information to a PSBT, and optionally signs it.
isminetype IsMine(const CScript &script) const override
std::map< CKeyID, std::pair< CPubKey, std::vector< unsigned char > >> CryptedKeyMap
bool HasPrivKey(const CKeyID &keyid) const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man)
KeyMap m_map_keys GUARDED_BY(cs_desc_man)
bool Encrypt(const CKeyingMaterial &master_key, WalletBatch *batch) override
bool AddCryptedKeyInner(const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret)
std::vector< CKeyPool > MarkReserveKeysAsUsed(int64_t keypool_id) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
Marks all keys in the keypool up to and including the provided key as used.
bool DeleteRecords()
Delete all the records ofthis LegacyScriptPubKeyMan from disk.
bool GetKeyOrigin(const CKeyID &keyid, KeyOriginInfo &info) const override
bool CanGetAddresses(bool internal=false) const override
bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey) override
Adds a key to the store, and saves it to disk.
util::Result< CTxDestination > GetNewDestination(const OutputType type) override
bool GetKeyFromPool(CPubKey &key, const OutputType type)
Fetches a key from the keypool.
WalletBatch *encrypted_batch GUARDED_BY(cs_KeyStore)
util::Result< CTxDestination > GetReservedDestination(const OutputType type, bool internal, int64_t &index, CKeyPool &keypool) override
void AddInactiveHDChain(const CHDChain &chain)
bool Encrypt(const CKeyingMaterial &master_key, WalletBatch *batch) override
void AddHDChain(const CHDChain &chain)
bool LoadCryptedKey(const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret, bool checksum_valid)
Adds an encrypted key to the store, without saving it to disk (used by LoadWallet)
bool AddCScriptWithDB(WalletBatch &batch, const CScript &script)
Adds a script to the store and saves it to disk.
std::unordered_map< CKeyID, CHDChain, SaltedSipHasher > m_inactive_hd_chains
bool GetKey(const CKeyID &address, CKey &keyOut) const override
std::map< CKeyID, std::pair< CPubKey, std::vector< unsigned char > >> CryptedKeyMap
bool AddKeyOriginWithDB(WalletBatch &batch, const CPubKey &pubkey, const KeyOriginInfo &info)
Add a KeyOriginInfo to the wallet.
void MarkPreSplitKeys() EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
SigningResult SignMessage(const std::string &message, const PKHash &pkhash, std::string &str_sig) const override
Sign a message with the given script.
uint256 GetID() const override
bool AddWatchOnlyInMem(const CScript &dest)
bool HaveWatchOnly() const
Returns whether there are any watch-only things in the wallet.
std::map< CKeyID, CPubKey > WatchKeyMap
void LoadKeyMetadata(const CKeyID &keyID, const CKeyMetadata &metadata)
Load metadata (used by LoadWallet)
bool CheckDecryptionKey(const CKeyingMaterial &master_key) override
Check that the given decryption key is valid for this ScriptPubKeyMan, i.e. it decrypts all of the ke...
bool SignTransaction(CMutableTransaction &tx, const std::map< COutPoint, Coin > &coins, int sighash, std::map< int, bilingual_str > &input_errors) const override
Creates new signatures and adds them to the transaction.
const CHDChain & GetHDChain() const
bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret)
Adds an encrypted key to the store, and saves it to disk.
bool ReserveKeyFromKeyPool(int64_t &nIndex, CKeyPool &keypool, bool fRequestedInternal)
Reserves a key from the keypool and sets nIndex to its index.
int64_t m_keypool_size GUARDED_BY(cs_KeyStore)
Number of pre-generated keys/scripts (part of the look-ahead process, used to detect payments)
void AddKeypoolPubkeyWithDB(const CPubKey &pubkey, const bool internal, WalletBatch &batch)
std::map< int64_t, CKeyID > m_index_to_reserved_key
bool fDecryptionThoroughlyChecked
keeps track of whether Unlock has run a thorough check before
bool ImportScripts(const std::set< CScript > scripts, int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
std::map< CScriptID, CKeyMetadata > m_script_metadata GUARDED_BY(cs_KeyStore)
void UpgradeKeyMetadata()
Upgrade stored CKeyMetadata objects to store key origin info as KeyOriginInfo.
bool AddWatchOnly(const CScript &dest) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
Private version of AddWatchOnly method which does not accept a timestamp, and which will reset the wa...
std::map< CKeyID, CKeyMetadata > mapKeyMetadata GUARDED_BY(cs_KeyStore)
bool HavePrivateKeys() const override
std::set< CScript > WatchOnlySet
void LoadScriptMetadata(const CScriptID &script_id, const CKeyMetadata &metadata)
std::unique_ptr< SigningProvider > GetSolvingProvider(const CScript &script) const override
std::unordered_set< CScript, SaltedSipHasher > GetNotMineScriptPubKeys() const
Retrieves scripts that were imported by bugs into the legacy spkm and are simply invalid,...
int64_t nTimeFirstKey GUARDED_BY(cs_KeyStore)
TransactionError FillPSBT(PartiallySignedTransaction &psbt, const PrecomputedTransactionData &txdata, int sighash_type=SIGHASH_DEFAULT, bool sign=true, bool bip32derivs=false, int *n_signed=nullptr, bool finalize=true) const override
Adds script and derivation path information to a PSBT, and optionally signs it.
std::vector< WalletDestination > MarkUnusedAddresses(const CScript &script) override
Mark unused addresses as being used Affects all keys up to and including the one determined by provid...
bool LoadKey(const CKey &key, const CPubKey &pubkey)
Adds a key to the store, without saving it to disk (used by LoadWallet)
void UpdateTimeFirstKey(int64_t nCreateTime) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
Update wallet first key creation time.
bool TopUp(unsigned int size=0) override
Fills internal address pool.
unsigned int GetKeyPoolSize() const override
bool LoadWatchOnly(const CScript &dest)
Adds a watch-only address to the store, without saving it to disk (used by LoadWallet)
void LoadKeyPool(int64_t nIndex, const CKeyPool &keypool)
Load a keypool entry.
bool TopUpInactiveHDChain(const CKeyID seed_id, int64_t index, bool internal)
Like TopUp() but adds keys for inactive HD chains.
bool CanProvide(const CScript &script, SignatureData &sigdata) override
Whether this ScriptPubKeyMan can provide a SigningProvider (via GetSolvingProvider) that,...
void LoadHDChain(const CHDChain &chain)
Load a HD chain model (used by LoadWallet)
std::set< CKeyID > GetKeys() const override
bool AddKeyPubKeyInner(const CKey &key, const CPubKey &pubkey)
bool ImportPubKeys(const std::vector< CKeyID > &ordered_pubkeys, const std::map< CKeyID, CPubKey > &pubkey_map, const std::map< CKeyID, std::pair< CPubKey, KeyOriginInfo >> &key_origins, const bool add_keypool, const bool internal, const int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
std::unordered_set< CScript, SaltedSipHasher > GetScriptPubKeys() const override
Returns a set of all the scriptPubKeys that this ScriptPubKeyMan watches.
bool IsHDEnabled() const override
bool TopUpChain(WalletBatch &batch, CHDChain &chain, unsigned int size)
bool AddKeyPubKeyWithDB(WalletBatch &batch, const CKey &key, const CPubKey &pubkey) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
Adds a key to the store, and saves it to disk.
bool GetWatchPubKey(const CKeyID &address, CPubKey &pubkey_out) const
Fetches a pubkey from mapWatchKeys if it exists there.
isminetype IsMine(const CScript &script) const override
bool AddCScript(const CScript &redeemScript) override
int64_t GetTimeFirstKey() const override
const std::map< CKeyID, int64_t > & GetAllReserveKeys() const
bool NewKeyPool()
Mark old keypool keys as used, and generate all new keys.
CryptedKeyMap mapCryptedKeys GUARDED_BY(cs_KeyStore)
bool GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const override
bool SetupGeneration(bool force=false) override
Sets up the key generation stuff, i.e.
void LearnRelatedScripts(const CPubKey &key, OutputType)
Explicitly make the wallet learn the related scripts for outputs to the given key.
WatchKeyMap mapWatchKeys GUARDED_BY(cs_KeyStore)
void LearnAllRelatedScripts(const CPubKey &key)
Same as LearnRelatedScripts, but when the OutputType is not known (and could be anything).
CPubKey DeriveNewSeed(const CKey &key)
std::optional< MigrationData > MigrateToDescriptor()
Get the DescriptorScriptPubKeyMans (with private keys) that have the same scriptPubKeys as this Legac...
void DeriveNewChildKey(WalletBatch &batch, CKeyMetadata &metadata, CKey &secret, CHDChain &hd_chain, bool internal=false) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
bool LoadCScript(const CScript &redeemScript)
Adds a CScript to the store.
void ReturnDestination(int64_t index, bool internal, const CTxDestination &) override
std::map< CKeyID, int64_t > m_pool_key_to_index
CPubKey GenerateNewKey(WalletBatch &batch, CHDChain &hd_chain, bool internal=false) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
Generate a new key.
void SetHDSeed(const CPubKey &key)
bool AddWatchOnlyWithDB(WalletBatch &batch, const CScript &dest) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
bool ImportPrivKeys(const std::map< CKeyID, CKey > &privkey_map, const int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
std::unique_ptr< CKeyMetadata > GetMetadata(const CTxDestination &dest) const override
bool Upgrade(int prev_version, int new_version, bilingual_str &error) override
Upgrades the wallet to the specified version.
void KeepDestination(int64_t index, const OutputType &type) override
void RewriteDB() override
The action to do when the DB needs rewrite.
std::optional< int64_t > GetOldestKeyPoolTime() const override
bool RemoveWatchOnly(const CScript &dest)
Remove a watch only script from the keystore.
WatchOnlySet setWatchOnly GUARDED_BY(cs_KeyStore)
bool HaveKey(const CKeyID &address) const override
bool ImportScriptPubKeys(const std::set< CScript > &script_pub_keys, const bool have_solving_data, const int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_KeyStore)
Wraps a LegacyScriptPubKeyMan so that it can be returned in a new unique_ptr.
bool HaveKey(const CKeyID &address) const override
bool GetPubKey(const CKeyID &address, CPubKey &pubkey) const override
bool GetKey(const CKeyID &address, CKey &key) const override
bool HaveCScript(const CScriptID &scriptid) const override
bool GetKeyOrigin(const CKeyID &keyid, KeyOriginInfo &info) const override
LegacySigningProvider(const LegacyScriptPubKeyMan &spk_man)
bool GetCScript(const CScriptID &scriptid, CScript &script) const override
const LegacyScriptPubKeyMan & m_spk_man
virtual uint256 GetID() const
virtual unsigned int GetKeyPoolSize() const
virtual TransactionError FillPSBT(PartiallySignedTransaction &psbt, const PrecomputedTransactionData &txdata, int sighash_type=SIGHASH_DEFAULT, bool sign=true, bool bip32derivs=false, int *n_signed=nullptr, bool finalize=true) const
Adds script and derivation path information to a PSBT, and optionally signs it.
virtual int64_t GetTimeFirstKey() const
virtual bool TopUp(unsigned int size=0)
Fills internal address pool.
virtual std::unique_ptr< SigningProvider > GetSolvingProvider(const CScript &script) const
virtual std::vector< WalletDestination > MarkUnusedAddresses(const CScript &script)
Mark unused addresses as being used Affects all keys up to and including the one determined by provid...
virtual void KeepDestination(int64_t index, const OutputType &type)
virtual bool Upgrade(int prev_version, int new_version, bilingual_str &error)
Upgrades the wallet to the specified version.
boost::signals2::signal< void(bool fHaveWatchOnly)> NotifyWatchonlyChanged
Watch-only address added.
virtual void ReturnDestination(int64_t index, bool internal, const CTxDestination &addr)
ScriptPubKeyMan(WalletStorage &storage)
virtual SigningResult SignMessage(const std::string &message, const PKHash &pkhash, std::string &str_sig) const
Sign a message with the given script.
virtual std::unique_ptr< CKeyMetadata > GetMetadata(const CTxDestination &dest) const
virtual std::unordered_set< CScript, SaltedSipHasher > GetScriptPubKeys() const
Returns a set of all the scriptPubKeys that this ScriptPubKeyMan watches.
boost::signals2::signal< void(const ScriptPubKeyMan *spkm, int64_t new_birth_time)> NotifyFirstKeyTimeChanged
Birth time changed.
void WalletLogPrintf(const char *fmt, Params... parameters) const
Prepends the wallet name in logging output to ease debugging in multi-wallet use cases.
virtual void RewriteDB()
The action to do when the DB needs rewrite.
virtual isminetype IsMine(const CScript &script) const
virtual util::Result< CTxDestination > GetReservedDestination(const OutputType type, bool internal, int64_t &index, CKeyPool &keypool)
virtual std::optional< int64_t > GetOldestKeyPoolTime() const
virtual util::Result< CTxDestination > GetNewDestination(const OutputType type)
virtual bool HavePrivateKeys() const
virtual bool Encrypt(const CKeyingMaterial &master_key, WalletBatch *batch)
virtual bool SignTransaction(CMutableTransaction &tx, const std::map< COutPoint, Coin > &coins, int sighash, std::map< int, bilingual_str > &input_errors) const
Creates new signatures and adds them to the transaction.
virtual bool CanProvide(const CScript &script, SignatureData &sigdata)
Whether this ScriptPubKeyMan can provide a SigningProvider (via GetSolvingProvider) that,...
virtual bool SetupGeneration(bool force=false)
Sets up the key generation stuff, i.e.
virtual bool CheckDecryptionKey(const CKeyingMaterial &master_key)
Check that the given decryption key is valid for this ScriptPubKeyMan, i.e. it decrypts all of the ke...
boost::signals2::signal< void()> NotifyCanGetAddressesChanged
Keypool has new keys.
virtual bool IsHDEnabled() const
virtual bool CanGetAddresses(bool internal=false) const
WalletStorage & m_storage
Access to the wallet database.
Definition: walletdb.h:191
An instance of this class represents one database.
Definition: db.h:124
Descriptor with some wallet metadata.
Definition: walletutil.h:85
virtual bool IsWalletFlagSet(uint64_t) const =0
virtual void TopUpCallback(const std::set< CScript > &, ScriptPubKeyMan *)=0
Callback function for after TopUp completes containing any scripts that were added by a SPKMan.
virtual void SetMinVersion(enum WalletFeature, WalletBatch *=nullptr)=0
virtual bool CanSupportFeature(enum WalletFeature) const =0
virtual std::string GetDisplayName() const =0
virtual WalletDatabase & GetDatabase() const =0
virtual void UnsetBlankWalletFlag(WalletBatch &)=0
virtual bool IsLocked() const =0
virtual ~WalletStorage()=default
virtual bool HasEncryptionKeys() const =0
virtual bool WithEncryptionKey(std::function< bool(const CKeyingMaterial &)> cb) const =0
Pass the encryption key to cb().
TransactionError
Definition: error.h:22
@ SIGHASH_DEFAULT
Taproot only; implied when sighash byte is missing, and equivalent to SIGHASH_ALL.
Definition: interpreter.h:35
#define LogPrintf(...)
Definition: logging.h:244
SigningResult
Definition: message.h:43
std::vector< unsigned char, secure_allocator< unsigned char > > CKeyingMaterial
Definition: crypter.h:62
std::vector< CKeyID > GetAffectedKeys(const CScript &spk, const SigningProvider &provider)
static const unsigned int DEFAULT_KEYPOOL_SIZE
Default for -keypool.
static const std::unordered_set< OutputType > LEGACY_OUTPUT_TYPES
OutputTypes supported by the LegacyScriptPubKeyMan.
static constexpr int64_t UNKNOWN_TIME
Constant representing an unknown spkm creation time.
isminetype
IsMine() return codes, which depend on ScriptPubKeyMan implementation.
Definition: types.h:40
@ ISMINE_NO
Definition: types.h:41
WalletFeature
(client) version numbers for particular wallet features
Definition: walletutil.h:16
OutputType
Definition: outputtype.h:17
Definition: key.h:210
A mutable version of CTransaction.
Definition: transaction.h:378
A version of CTransaction with the PSBT format.
Definition: psbt.h:947
Bilingual messages:
Definition: translation.h:18
struct containing information needed for migrating legacy wallets to descriptor wallets
std::vector< std::unique_ptr< DescriptorScriptPubKeyMan > > desc_spkms
std::vector< std::pair< std::string, int64_t > > solvable_descs
std::vector< std::pair< std::string, int64_t > > watch_descs
#define EXCLUSIVE_LOCKS_REQUIRED(...)
Definition: threadsafety.h:49
int64_t GetTime()
Definition: time.cpp:48
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
Definition: translation.h:48