7#include <chainparams.h>
19 if (!fs::is_directory(path)) {
27 if (fs::is_directory(path /
"wallets")) {
37 return wallet_version >= feature_version;
44 if (version >= wf)
return wf;
51 int64_t creation_time =
GetTime();
56 std::string desc_prefix;
57 std::string desc_suffix =
"/*)";
60 desc_prefix =
"pkh(" + xpub +
"/44h";
64 desc_prefix =
"sh(wpkh(" + xpub +
"/49h";
69 desc_prefix =
"wpkh(" + xpub +
"/84h";
73 desc_prefix =
"tr(" + xpub +
"/86h";
82 assert(!desc_prefix.empty());
85 if (
Params().IsTestChain()) {
91 std::string internal_path = internal ?
"/1" :
"/0";
92 std::string desc_str = desc_prefix +
"/0h" + internal_path + desc_suffix;
97 std::vector<std::unique_ptr<Descriptor>> desc =
Parse(desc_str, keys, error,
false);
const CChainParams & Params()
Return the currently selected parameters.
fs::path GetDataDirNet() const
Get data directory path with appended network identifier.
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
fs::path GetPathArg(std::string arg, const fs::path &default_value={}) const
Return path argument or default value.
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
Descriptor with some wallet metadata.
static UniValue Parse(std::string_view raw)
Parse string to UniValue or throw runtime_error if string contains invalid JSON.
std::string EncodeExtPubKey(const CExtPubKey &key)
fs::path GetWalletDir()
Get the path of the wallet directory.
WalletFeature
(client) version numbers for particular wallet features
@ FEATURE_PRE_SPLIT_KEYPOOL
bool IsFeatureSupported(int wallet_version, int feature_version)
WalletFeature GetClosestWalletFeature(int version)
WalletDescriptor GenerateWalletDescriptor(const CExtPubKey &master_key, const OutputType &addr_type, bool internal)
int64_t GetTime()
DEPRECATED Use either ClockType::now() or Now<TimePointType>() if a cast is needed.