5#ifndef BITCOIN_WALLET_WALLETUTIL_H
6#define BITCOIN_WALLET_WALLETUTIL_H
104 template <
typename Stream>
107 std::string descriptor_str =
descriptor->ToString();
111 template <
typename Stream>
114 std::string descriptor_str;
121 auto descs =
Parse(descriptor_str,
keys, error,
true);
123 throw std::ios_base::failure(
"Invalid descriptor: " + error);
125 if (descs.size() > 1) {
126 throw std::ios_base::failure(
"Can't load a multipath descriptor from databases");
#define CHECK_NONFATAL(condition)
Identity function.
Cache for single descriptor's derived extended pubkeys.
Descriptor with some wallet metadata.
WalletDescriptor(std::shared_ptr< Descriptor > descriptor, uint64_t creation_time, int32_t range_start, int32_t range_end, int32_t next_index)
uint256 GetCanonicalHash() const
std::optional< uint256 > m_canonical_hash
static WalletDescriptor FromStream(deserialize_type, Stream &s)
void Serialize(Stream &s) const
WalletDescriptor()=delete
bool IsCanonicallyEquivalent(const WalletDescriptor &other) const
void IncNext()
Increments the next_index of the descriptor.
void SetEnd(int32_t end)
Sets the range_end of the descriptor.
void DecNext()
Increments the next_index of the descriptor.
const std::shared_ptr< const Descriptor > descriptor
void UpdateFrom(const WalletDescriptor &other)
Replaces all metadata (range, start, end, creation time), and cache from another WalletDescriptor if ...
static UniValue Parse(std::string_view raw, ParamFormat format=ParamFormat::JSON)
Parse string to UniValue or throw runtime_error if string contains invalid JSON.
fs::path GetWalletDir()
Get the path of the wallet directory.
@ WALLET_FLAG_EXTERNAL_SIGNER
Indicates that the wallet needs an external signer.
@ WALLET_FLAG_LAST_HARDENED_XPUB_CACHED
@ WALLET_FLAG_KEY_ORIGIN_METADATA
@ WALLET_FLAG_AVOID_REUSE
@ WALLET_FLAG_DESCRIPTORS
Indicate that this wallet supports DescriptorScriptPubKeyMan.
@ WALLET_FLAG_DISABLE_PRIVATE_KEYS
@ WALLET_FLAG_BLANK_WALLET
Flag set when a wallet contains no HD seed and no private keys, scripts, addresses,...
WalletDescriptor GenerateWalletDescriptor(const CExtPubKey &master_key, const OutputType &addr_type, bool internal)
Dummy data type to identify deserializing constructors.
std::vector< uint16_t > keys