9#include <chainparams.h>
46 "You need to rescan the blockchain in order to correctly mark used "
47 "destinations in the past. Until this is done, some destinations may "
48 "be considered unused, even if the opposite is the case."},
62 if (value.isStr() && value.get_str() ==
wallet_name) {
78 if (!value.isStr() || value.get_str() !=
wallet_name) {
91 std::vector<bilingual_str> &
warnings) {
97 Untranslated(
"Wallet load on startup setting could not be updated, "
98 "so wallet may not be loaded next node startup."));
102 Untranslated(
"Wallet load on startup setting could not be updated, "
103 "so wallet may still be loaded next node startup."));
110 std::vector<std::shared_ptr<CWallet>>::const_iterator i =
116 wallet->ConnectScriptPubKeyManNotifiers();
117 wallet->NotifyCanGetAddressesChanged();
123 std::vector<bilingual_str> &
warnings) {
130 wallet->m_chain_notifications_handler.reset();
132 std::vector<std::shared_ptr<CWallet>>::iterator i =
147 std::vector<bilingual_str>
warnings;
166std::unique_ptr<interfaces::Handler>
180static std::set<std::string>
182static std::set<std::string>
188 wallet->WalletLogPrintf(
"Releasing wallet\n");
226std::shared_ptr<CWallet>
232 std::unique_ptr<WalletDatabase> database =
240 std::shared_ptr<CWallet>
wallet =
250 wallet->postInitProcess();
256 }
catch (
const std::runtime_error &
e) {
264std::shared_ptr<CWallet>
268 std::vector<bilingual_str> &
warnings) {
271 if (!result.second) {
282std::shared_ptr<CWallet>
286 std::vector<bilingual_str> &
warnings) {
301 std::unique_ptr<WalletDatabase> database =
314 "Passphrase provided but private keys are disabled. A passphrase "
315 "is only used to encrypt private keys, so cannot be used for "
316 "wallets with private keys disabled.");
322 std::shared_ptr<CWallet>
wallet =
337 Untranslated(
"Error: Wallet created but failed to encrypt.");
345 "Error: Wallet was encrypted but could not be unlocked");
354 wallet->SetupDescriptorScriptPubKeyMans();
357 if (!
spk_man->SetupGeneration()) {
372 wallet->postInitProcess();
394 std::map<TxId, CWalletTx>::const_iterator it = mapWallet.find(txid);
395 if (it == mapWallet.end()) {
399 return &(it->second);
424 if (!
crypter.SetKeyFromPassphrase(
457 if (!
crypter.SetKeyFromPassphrase(
474 pMasterKey.second.nDeriveIterations =
static_cast<unsigned int>(
485 static_cast<unsigned int>(
490 if (
pMasterKey.second.nDeriveIterations < 25000) {
495 "Wallet passphrase changed to an nDeriveIterations of %i\n",
498 if (!
crypter.SetKeyFromPassphrase(
570 std::set<TxId> result;
573 std::map<TxId, CWalletTx>::const_iterator it = mapWallet.find(txid);
574 if (it == mapWallet.end()) {
580 std::pair<TxSpends::const_iterator, TxSpends::const_iterator>
range;
582 for (
const CTxIn &
txin : wtx.
tx->vin) {
591 result.insert(
_it->second);
613 std::pair<TxSpends::iterator, TxSpends::iterator>
range) {
620 for (TxSpends::iterator it =
range.first; it !=
range.second; ++it) {
621 const CWalletTx *wtx = &mapWallet.at(it->second);
633 for (TxSpends::iterator it =
range.first; it !=
range.second; ++it) {
634 const TxId &txid = it->second;
642 "Oldest wallet transaction in range assumed to have been found.");
664 std::pair<TxSpends::const_iterator, TxSpends::const_iterator>
range =
667 for (TxSpends::const_iterator it =
range.first; it !=
range.second; ++it) {
669 std::map<TxId, CWalletTx>::const_iterator
mit = mapWallet.find(
wtxid);
670 if (
mit != mapWallet.end()) {
672 if (depth > 0 || (depth == 0 && !
mit->second.isAbandoned())) {
687 std::pair<TxSpends::iterator, TxSpends::iterator>
range;
693 auto it = mapWallet.find(
wtxid);
694 assert(it != mapWallet.end());
697 if (
thisTx.IsCoinBase()) {
725 kMasterKey.nDeriveIterations =
static_cast<unsigned int>(
734 static_cast<unsigned int>(
kMasterKey.nDeriveIterations * 100 /
804 if (!
spk_man->SetupGeneration(
true)) {
837 for (
auto &entry : mapWallet) {
848 if (nOrderPos == -1) {
896 for (std::pair<const TxId, CWalletTx> &item : mapWallet) {
897 item.second.MarkDirty();
902 unsigned int n,
bool used,
940 for (
const auto &
keyid :
955 bool fFlushOnClose) {
960 const TxId &txid = tx->GetId();
966 for (
const CTxIn &
txin : tx->vin) {
967 const COutPoint &
op =
txin.prevout;
977 mapWallet.emplace(std::piecewise_construct, std::forward_as_tuple(txid),
978 std::forward_as_tuple(tx));
1021#if defined(HAVE_SYSTEM)
1048 mapWallet.emplace(std::piecewise_construct, std::forward_as_tuple(txid),
1049 std::forward_as_tuple(
nullptr));
1059 if (
chain().findBlock(
1061 FoundBlock().inActiveChain(active).height(height)) &&
1084 for (
const CTxIn &
txin : wtx.
tx->vin) {
1085 auto it = mapWallet.find(
txin.prevout.GetTxId());
1086 if (it != mapWallet.end()) {
1088 if (
prevtx.isConflicted()) {
1102 const TxId &txid =
ptx->GetId();
1104 if (!
confirm.hashBlock.IsNull()) {
1105 for (
const CTxIn &
txin :
ptx->vin) {
1106 std::pair<TxSpends::const_iterator, TxSpends::const_iterator>
1109 if (
range.first->second != txid) {
1111 "Transaction %s (in block %s) conflicts with wallet "
1112 "transaction %s (both spend %s:%i)\n",
1114 range.first->second.ToString(),
1115 range.first->first.GetTxId().ToString(),
1116 range.first->first.GetN());
1118 range.first->second);
1125 bool fExisted = mapWallet.count(txid) != 0;
1141 spk_man_pair.second->MarkUnusedAddresses(txout.scriptPubKey);
1162 for (
const CTxIn &
txin : tx->vin) {
1163 auto it = mapWallet.find(
txin.prevout.GetTxId());
1164 if (it != mapWallet.end()) {
1165 it->second.MarkDirty();
1175 std::set<TxId>
todo;
1176 std::set<TxId> done;
1179 auto it = mapWallet.find(txid);
1180 assert(it != mapWallet.end());
1188 while (!
todo.empty()) {
1192 it = mapWallet.find(now);
1193 assert(it != mapWallet.end());
1210 TxSpends::const_iterator
iter =
1213 if (!done.count(
iter->second)) {
1246 std::set<TxId>
todo;
1247 std::set<TxId> done;
1251 while (!
todo.empty()) {
1255 auto it = mapWallet.find(now);
1256 assert(it != mapWallet.end());
1270 TxSpends::const_iterator
iter =
1273 if (!done.count(
iter->second)) {
1306 auto it = mapWallet.find(tx->GetId());
1307 if (it != mapWallet.end()) {
1308 it->second.fInMempool =
true;
1316 auto it = mapWallet.find(tx->GetId());
1317 if (it != mapWallet.end()) {
1318 it->second.fInMempool =
false;
1360 for (
size_t index = 0; index < block.
vtx.size(); index++) {
1362 block_hash, int(index)});
1390void CWallet::BlockUntilSyncedToCurrentChain()
const {
1405 std::map<TxId, CWalletTx>::const_iterator
mi =
1406 mapWallet.find(
txin.prevout.GetTxId());
1407 if (
mi != mapWallet.end()) {
1409 if (
txin.prevout.GetN() <
prev.tx->vout.size()) {
1411 return prev.
tx->vout[
txin.prevout.GetN()].nValue;
1433 result = std::max(result,
spk_man_pair.second->IsMine(script));
1440 for (
const CTxOut &txout : tx.vout) {
1456 for (
const CTxIn &
txin : tx.vin) {
1459 throw std::runtime_error(std::string(
__func__) +
1460 ": value out of range");
1471 result &=
spk_man->IsHDEnabled();
1494 throw std::runtime_error(std::string(
__func__) +
1495 ": writing wallet flags failed");
1508 throw std::runtime_error(std::string(
__func__) +
1509 ": writing wallet flags failed");
1537 throw std::runtime_error(std::string(
__func__) +
1538 ": writing wallet flags failed");
1547 bool use_max_sig)
const {
1552 std::unique_ptr<SigningProvider> provider =
1562 scriptPubKey, sigdata)) {
1573 const std::vector<CTxOut> &
txouts,
1574 bool use_max_sig)
const {
1577 for (
const auto &txout :
txouts) {
1610 const std::map<
CKeyID, std::pair<CPubKey, KeyOriginInfo>> &key_origins,
1748 strprintf(
"%s " +
_(
"Rescanning...").translated,
1786 block_height, block_hash,
1789 {CWalletTx::Status::CONFIRMED, block_height,
1790 block_hash, int(posInBlock)},
1836 }
else if (block_height &&
chain().shutdownRequested()) {
1838 "Rescan interrupted by shutdown request at block %d. Progress=%f\n",
1857 std::map<int64_t, CWalletTx *>
mapSorted;
1861 for (std::pair<const TxId, CWalletTx> &item : mapWallet) {
1874 for (
const std::pair<const int64_t, CWalletTx *> &item :
mapSorted) {
1925 std::set<TxId> result;
1945 if (!
chain().isReadyToBroadcast()) {
1968 for (std::pair<const TxId, CWalletTx> &item : mapWallet) {
1992 for (
const std::shared_ptr<CWallet> &pwallet :
GetWallets()) {
1993 pwallet->ResendWalletTransactions();
2007 std::map<COutPoint, Coin> coins;
2008 for (
auto &input : tx.
vin) {
2009 auto mi = mapWallet.find(input.prevout.GetTxId());
2010 if (
mi == mapWallet.end() ||
2011 input.prevout.GetN() >=
mi->second.tx->vout.size()) {
2015 coins[input.prevout] =
2024 const std::map<COutPoint, Coin> &coins,
2055 for (
size_t i = 0; i <
psbtx.tx->vin.size(); ++i) {
2065 const TxId &txid =
txin.prevout.GetTxId();
2066 const auto it = mapWallet.find(txid);
2067 if (it != mapWallet.end()) {
2087 for (
const auto &input :
psbtx.inputs) {
2109 const std::vector<CRecipient> &
vecSend)
const {
2126 std::vector<std::pair<std::string, std::string>>
orderForm,
2137 wtx.
mapValue = std::move(mapValue);
2145 for (
const CTxIn &
txin : tx->vin) {
2153 CWalletTx &wtx = mapWallet.at(tx->GetId());
2163 WalletLogPrintf(
"CommitTransaction(): Transaction cannot be broadcast "
2164 "immediately, %s\n",
2177 if (
database->Rewrite(
"\x04pool")) {
2207 const auto &it = mapWallet.find(txid);
2208 wtxOrdered.erase(it->second.m_it_wtxOrdered);
2209 for (
const auto &
txin : it->second.tx->vin) {
2212 mapWallet.erase(it);
2217 if (
database->Rewrite(
"\x04pool")) {
2241 std::map<CTxDestination, CAddressBookData>::iterator
mi =
2281 "%s called with IsMine address, NOT SUPPORTED. Please "
2282 "report this bug! %s\n",
2287 for (
const std::pair<const std::string, std::string> &item :
2304 unsigned int count = 0;
2315 unsigned int count = 0;
2335 bool result =
false;
2339 result =
spk_man->GetNewDestination(type, dest,
error);
2353 std::string &
error) {
2358 if (!
reservedest.GetReservedDestination(dest,
true)) {
2359 error =
_(
"Error: Keypool ran out, please call keypoolrefill first")
2380 for (
auto &entry : mapWallet) {
2386 for (
size_t i = 0; i < wtx.
tx->vout.size(); i++) {
2398std::set<CTxDestination>
2401 std::set<CTxDestination> result;
2402 for (
const std::pair<const CTxDestination, CAddressBookData> &item :
2404 if (item.second.IsChange()) {
2408 const std::string &
strName = item.second.GetLabel();
2410 result.insert(address);
2505 for (
const auto &entry :
spk_man->mapKeyMetadata) {
2506 if (entry.second.nCreateTime) {
2507 mapKeyBirth[entry.first] = entry.second.nCreateTime;
2524 for (
const auto &entry : mapWallet) {
2529 for (
const CTxOut &txout : wtx.
tx->vout) {
2531 for (
const auto &
keyid :
2537 rit->second->block_height) {
2620 const std::string &key,
const std::string &value) {
2621 if (std::get_if<CNoDestination>(&dest)) {
2625 m_address_book[dest].destdata.insert(std::make_pair(key, value));
2630 const std::string &key) {
2639 const std::string &value) {
2640 m_address_book[dest].destdata.insert(std::make_pair(key, value));
2644 std::string *value)
const {
2645 std::map<CTxDestination, CAddressBookData>::const_iterator i =
2648 CAddressBookData::StringMap::const_iterator
j =
2649 i->second.destdata.find(key);
2650 if (
j != i->second.destdata.end()) {
2661std::vector<std::string>
2663 std::vector<std::string> values;
2665 for (
const auto &data : address.second.destdata) {
2667 values.emplace_back(data.second);
2674std::unique_ptr<WalletDatabase>
2686 if (!(
path_type == fs::file_type::not_found ||
2687 path_type == fs::file_type::directory ||
2693 strprintf(
"Invalid -wallet path '%s'. -wallet path should point to "
2694 "a directory where wallet.dat and "
2695 "database/log.?????????? files can be stored, a location "
2696 "where such a directory could be created, "
2697 "or (for backwards compatibility) the name of an "
2698 "existing data file in -walletdir (%s)",
2706std::shared_ptr<CWallet>
2708 std::unique_ptr<WalletDatabase> database,
2710 std::vector<bilingual_str> &
warnings) {
2731 strprintf(
_(
"Error reading %s! All keys read correctly, but "
2732 "transaction data or address book entries might be "
2733 "missing or incorrect."),
2737 _(
"Error loading %s: Wallet requires newer version of %s"),
2742 _(
"Wallet needed to be rewritten: restart %s to complete"),
2774 if (!
spk_man->SetupGeneration()) {
2775 error =
_(
"Unable to generate initial keys");
2786 "disabled during creation"),
2792 if (
spk_man->HavePrivateKeys()) {
2794 strprintf(
_(
"Warning: Private keys detected in wallet {%s} "
2795 "with disabled private keys"),
2810 _(
"This is the minimum transaction fee you pay "
2811 "on every transaction."));
2828 _(
"This is the maximum transaction fee you pay (in addition to"
2829 " the normal fee) to prioritize partial spend avoidance over"
2830 " regular coin selection."));
2839 strprintf(
_(
"Invalid amount for -fallbackfee=<amount>: '%s'"),
2846 _(
"This is the transaction fee you may pay when "
2847 "fee estimates are not available."));
2863 _(
"This is the transaction fee you will pay if "
2864 "you send a transaction."));
2869 "(must be at least %s)"),
2883 warnings.push_back(
_(
"-maxtxfee is set very high! Fees this large "
2884 "could be paid on a single transaction."));
2888 _(
"Invalid amount for -maxtxfee=<amount>: '%s' (must be at "
2889 "least the minrelay fee of %s to prevent stuck "
2900 _(
"The wallet will avoid paying less than the minimum relay fee."));
2908 walletInstance->WalletLogPrintf(
"Wallet completed loading in %15dms\n",
2959 while (block_height > 0 &&
2966 error =
_(
"Prune: last wallet synchronisation goes beyond "
2967 "pruned data. You need to -reindex (download the "
2968 "whole blockchain again in case of pruned node)");
2975 "Rescanning last %i blocks (from block %i)...\n",
2998 ->ScanForWalletTransactions(
3002 error =
_(
"Failed to rescan the wallet during initialization");
3057 error =
_(
"Cannot downgrade wallet");
3071 error =
_(
"Cannot upgrade a non HD split wallet without upgrading to "
3072 "support pre split keypool. Please use version 200300 or no "
3073 "version specified.");
3190 std::set<ScriptPubKeyMan *>
spk_mans;
3191 for (
bool internal : {
false,
true}) {
3203 std::set<ScriptPubKeyMan *>
spk_mans;
3212 const std::map<OutputType, ScriptPubKeyMan *> &
spk_managers =
3214 std::map<OutputType, ScriptPubKeyMan *>::const_iterator it =
3218 "%s scriptPubKey Manager for output type %d does not exist\n",
3219 internal ?
"Internal" :
"External",
static_cast<int>(type));
3225std::set<ScriptPubKeyMan *>
3228 std::set<ScriptPubKeyMan *>
spk_mans;
3230 if (
spk_man_pair.second->CanProvide(script, sigdata)) {
3240 if (
spk_man_pair.second->CanProvide(script, sigdata)) {
3254std::unique_ptr<SigningProvider>
3260std::unique_ptr<SigningProvider>
3264 if (
spk_man_pair.second->CanProvide(script, sigdata)) {
3265 return spk_man_pair.second->GetSolvingProvider(script);
3318 spk_man->NotifyCanGetAddressesChanged.connect(
3325 auto spk_manager = std::unique_ptr<ScriptPubKeyMan>(
3343 for (
bool internal : {
false,
true}) {
3346 std::make_unique<DescriptorScriptPubKeyMan>(*
this,
internal);
3349 throw std::runtime_error(
3351 ": Wallet is locked, cannot setup new descriptors");
3355 throw std::runtime_error(
3357 ": Could not encrypt new descriptors");
3373 throw std::runtime_error(std::string(
__func__) +
3374 ": writing active ScriptPubKeyMan id failed");
3388 "Setting spkMan to active: id = %s, type = %d, internal = %d\n",
3411 "Deactivate spkMan: id = %s, type = %d, internal = %d\n",
3416 throw std::runtime_error(
3418 ": erasing active ScriptPubKeyMan id failed");
3457 const std::string &label,
bool internal) {
3462 "Cannot add WalletDescriptor to a non-descriptor wallet\n");
3469 desc.descriptor->ToString());
3473 std::make_unique<DescriptorScriptPubKeyMan>(*
this,
desc);
3482 const CKey &key = entry.second;
3494 if (!
desc.descriptor->IsRange()) {
3498 "Could not generate scriptPubKeys (cache is empty)\n");
bool MoneyRange(const Amount nValue)
static constexpr Amount SATOSHI
static constexpr int64_t TIMESTAMP_WINDOW
Timestamp window used as a grace period by code that compares external timestamps (such as timestamps...
const CChainParams & Params()
Return the currently selected parameters.
#define CHECK_NONFATAL(condition)
Identity function.
#define Assert(val)
Identity function.
bool IsArgSet(const std::string &strArg) const
Return true if the given argument has been manually set.
std::string GetArg(const std::string &strArg, const std::string &strDefault) const
Return string argument or default value.
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
std::vector< CTransactionRef > vtx
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
Encryption/decryption context with key information.
Fee rate in satoshis per kilobyte: Amount / kB.
std::string ToString() const
Amount GetFeePerK() const
Return the fee in satoshis for a size of 1000 bytes.
An encapsulated secp256k1 private key.
void MakeNewKey(bool fCompressed)
Generate a new private key using a cryptographic PRNG.
CPubKey GetPubKey() const
Compute the public key from a private key.
A reference to a CKey: the Hash160 of its serialized public key.
A key from a CWallet's keypool.
bool fInternal
Whether this keypool entry is in the internal keypool (for change outputs)
CPubKey vchPubKey
The public key.
int64_t nTime
The time at which the key was generated. Set in AddKeypoolPubKeyWithDB.
bool m_pre_split
Whether this key was generated for a keypool before the wallet was upgraded to HD-split.
Private key encryption is done based on a CMasterKey, which holds a salt and random encryption key.
std::vector< uint8_t > vchSalt
A mutable version of CTransaction.
An encapsulated public key.
An output of a transaction.
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
std::unique_ptr< SigningProvider > GetSolvingProvider(const CScript &script) const
Get the SigningProvider for a script.
std::atomic< int64_t > m_best_block_time
BlockHash GetLastBlockHash() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
std::set< ScriptPubKeyMan * > GetScriptPubKeyMans(const CScript &script, SignatureData &sigdata) const
Get all of the ScriptPubKeyMans for a script given additional information in sigdata (populated by e....
bool HaveChain() const
Interface to assert chain access.
int GetTxBlocksToMaturity(const CWalletTx &wtx) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
bool DummySignTx(CMutableTransaction &txNew, const std::set< CTxOut > &txouts, bool use_max_sig=false) const
void ConnectScriptPubKeyManNotifiers()
Connect the signals from ScriptPubKeyMans to the signals in CWallet.
void AddActiveScriptPubKeyMan(uint256 id, OutputType type, bool internal)
Adds the active ScriptPubKeyMan for the specified type and internal.
void SetupLegacyScriptPubKeyMan()
Make a LegacyScriptPubKeyMan and set it for all types, internal, and external.
bool AddDestData(WalletBatch &batch, const CTxDestination &dest, const std::string &key, const std::string &value) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Adds a destination data tuple to the store, and saves it to disk When adding new fields,...
boost::signals2::signal< void()> NotifyCanGetAddressesChanged
Keypool has new keys.
const std::string GetDisplayName() const override
Returns a bracketed wallet name for displaying in logs, will return [default wallet] if the wallet ha...
MasterKeyMap mapMasterKeys
int GetTxDepthInMainChain(const CWalletTx &wtx) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Return depth of transaction in blockchain: <0 : conflicts with a transaction this deep in the blockch...
bool IsTxImmatureCoinBase(const CWalletTx &wtx) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
boost::signals2::signal< void(const std::string &title, int nProgress)> ShowProgress
Show progress e.g.
bool Unlock(const CKeyingMaterial &vMasterKeyIn, bool accept_no_keys=false)
bool GetBroadcastTransactions() const
Inquire whether this wallet broadcasts transactions.
void WalletLogPrintf(std::string fmt, Params... parameters) const
Prepends the wallet name in logging output to ease debugging in multi-wallet use cases.
interfaces::Chain & chain() const
Interface for accessing chain state.
void SetupDescriptorScriptPubKeyMans() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Create new DescriptorScriptPubKeyMans and add them to the wallet.
WalletDatabase & GetDatabase() override
interfaces::Chain * m_chain
Interface for accessing chain state.
bool WithEncryptionKey(const std::function< bool(const CKeyingMaterial &)> &cb) const override
Pass the encryption key to cb().
LegacyScriptPubKeyMan * GetOrCreateLegacyScriptPubKeyMan()
std::map< OutputType, ScriptPubKeyMan * > m_external_spk_managers
void DeactivateScriptPubKeyMan(const uint256 &id, OutputType type, bool internal)
Remove specified ScriptPubKeyMan from set of active SPK managers.
bool GetDestData(const CTxDestination &dest, const std::string &key, std::string *value) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Look up a destination data tuple in the store, return true if found false otherwise.
bool IsLegacy() const
Determine if we are a legacy wallet.
std::atomic< bool > fAbortRescan
std::map< uint256, std::unique_ptr< ScriptPubKeyMan > > m_spk_managers
void LoadActiveScriptPubKeyMan(uint256 id, OutputType type, bool internal)
Loads an active ScriptPubKeyMan for the specified type and internal.
static std::shared_ptr< CWallet > Create(interfaces::Chain &chain, const std::string &name, std::unique_ptr< WalletDatabase > database, uint64_t wallet_creation_flags, bilingual_str &error, std::vector< bilingual_str > &warnings)
Initializes the wallet, returns a new CWallet instance or a null pointer in case of an error.
boost::signals2::signal< void(CWallet *wallet, const CTxDestination &address, const std::string &label, bool isMine, const std::string &purpose, ChangeType status)> NotifyAddressBookChanged
Address book entry changed.
int GetLastBlockHeight() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Get last block processed height.
boost::signals2::signal< void(CWallet *wallet)> NotifyStatusChanged
Wallet status (encrypted, locked) changed.
OutputType m_default_address_type
DescriptorScriptPubKeyMan * GetDescriptorScriptPubKeyMan(const WalletDescriptor &desc) const
Return the DescriptorScriptPubKeyMan for a WalletDescriptor if it is already in the wallet.
void LoadDescriptorScriptPubKeyMan(uint256 id, WalletDescriptor &desc)
Instantiate a descriptor ScriptPubKeyMan from the WalletDescriptor and load it.
LegacyScriptPubKeyMan * GetLegacyScriptPubKeyMan() const
Get the LegacyScriptPubKeyMan which is used for all types, internal, and external.
std::atomic< uint64_t > m_wallet_flags
const std::string & GetName() const
Get a name for this wallet for logging/debugging purposes.
bool CanSupportFeature(enum WalletFeature wf) const override EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
check whether we are allowed to upgrade (or already support) to the named feature
bool BackupWallet(const std::string &strDest) const
unsigned int ComputeTimeSmart(const CWalletTx &wtx) const
Compute smart timestamp for a transaction being added to the wallet.
void WalletLogPrintfToBeContinued(std::string fmt, Params... parameters) const
std::unique_ptr< WalletDatabase > database
Internal database handle.
ScriptPubKeyMan * AddWalletDescriptor(WalletDescriptor &desc, const FlatSigningProvider &signing_provider, const std::string &label, bool internal) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Add a descriptor to the wallet, return a ScriptPubKeyMan & associated output type.
std::set< ScriptPubKeyMan * > GetActiveScriptPubKeyMans() const
Returns all unique ScriptPubKeyMans in m_internal_spk_managers and m_external_spk_managers.
std::vector< std::string > GetDestValues(const std::string &prefix) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Get all destination values matching a prefix.
boost::signals2::signal< void(bool fHaveWatchOnly)> NotifyWatchonlyChanged
Watch-only address added.
bool IsLocked() const override
std::map< OutputType, ScriptPubKeyMan * > m_internal_spk_managers
std::atomic< double > m_scanning_progress
int GetVersion() const
get the current wallet format (the oldest client version guaranteed to understand this wallet)
void GetKeyBirthTimes(std::map< CKeyID, int64_t > &mapKeyBirth) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
bool EraseDestData(WalletBatch &batch, const CTxDestination &dest, const std::string &key) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Erases a destination data tuple in the store and on disk.
boost::signals2::signal< void(CWallet *wallet, const TxId &txid, ChangeType status)> NotifyTransactionChanged
Wallet transaction added, removed or updated.
bool HasEncryptionKeys() const override
Amount m_default_max_tx_fee
Absolute maximum transaction fee (in satoshis) used by default for the wallet.
bool UpgradeWallet(int version, bilingual_str &error)
Upgrade the wallet.
bool fBroadcastTransactions
ScriptPubKeyMan * GetScriptPubKeyMan(const OutputType &type, bool internal) const
Get the ScriptPubKeyMan for the given OutputType and internal/external chain.
std::set< ScriptPubKeyMan * > GetAllScriptPubKeyMans() const
Returns all unique ScriptPubKeyMans.
std::multimap< int64_t, CWalletTx * > TxItems
void LoadDestData(const CTxDestination &dest, const std::string &key, const std::string &value) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Adds a destination data tuple to the store, without saving it to disk.
unsigned int nMasterKeyMaxID
std::function< bool(CWalletTx &wtx, bool new_tx)> UpdateWalletTxFn
Callback for updating transaction metadata in mapWallet.
void postInitProcess()
Wallet post-init setup Gives the wallet a chance to register repetitive tasks and complete post-init ...
const CAddressBookData * FindAddressBookEntry(const CTxDestination &, bool allow_change=false) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
A transaction with a bunch of additional info that only the owner cares about.
mapValue_t mapValue
Key/value map with information about the transaction.
bool isUnconfirmed() const
unsigned int nTimeSmart
Stable timestamp that never changes, and reflects the order a transaction was added to the wallet.
bool isConflicted() const
std::vector< std::pair< std::string, std::string > > vOrderForm
bool fFromMe
From me flag is set to 1 for transactions that were created by the wallet on this bitcoin node,...
unsigned int fTimeReceivedIsTxTime
void MarkDirty()
make sure balances are recalculated
bool m_is_cache_empty
This flag is true if all m_amounts caches are empty.
std::multimap< int64_t, CWalletTx * >::const_iterator m_it_wtxOrdered
unsigned int nTimeReceived
time received by this node
int64_t nOrderPos
position in ordered transaction list
Different type to mark Mutex at global scope.
A wrapper to reserve an address from a wallet.
bool fInternal
Whether this is from the internal (change output) keypool.
ScriptPubKeyMan * m_spk_man
The ScriptPubKeyMan to reserve from.
int64_t nIndex
The index of the address's key in the keypool.
CTxDestination address
The destination.
const CWallet *const pwallet
The wallet to reserve from.
A class implementing ScriptPubKeyMan manages some (or all) scriptPubKeys used in a wallet.
virtual bool TopUp(unsigned int size=0)
Fills internal address pool.
virtual bool GetReservedDestination(const OutputType type, bool internal, CTxDestination &address, int64_t &index, CKeyPool &keypool)
virtual void KeepDestination(int64_t index, const OutputType &type)
virtual void ReturnDestination(int64_t index, bool internal, const CTxDestination &addr)
Signature hash type wrapper class.
Access to the wallet database.
bool WriteActiveScriptPubKeyMan(uint8_t type, const uint256 &id, bool internal)
bool WriteMasterKey(unsigned int nID, const CMasterKey &kMasterKey)
bool WriteName(const CTxDestination &address, const std::string &strName)
bool WritePurpose(const CTxDestination &address, const std::string &purpose)
bool WriteMinVersion(int nVersion)
bool ErasePurpose(const CTxDestination &address)
bool EraseDestData(const CTxDestination &address, const std::string &key)
Erase destination data tuple from wallet database.
bool WriteWalletFlags(const uint64_t flags)
bool ReadBestBlock(CBlockLocator &locator)
bool WriteOrderPosNext(int64_t nOrderPosNext)
bool EraseActiveScriptPubKeyMan(uint8_t type, bool internal)
bool WriteTx(const CWalletTx &wtx)
bool EraseName(const CTxDestination &address)
bool WriteBestBlock(const CBlockLocator &locator)
DBErrors ZapSelectTx(std::vector< TxId > &txIdsIn, std::vector< TxId > &txIdsOut)
DBErrors LoadWallet(CWallet *pwallet)
bool WriteDestData(const CTxDestination &address, const std::string &key, const std::string &value)
Write destination data key,value tuple to database.
Descriptor with some wallet metadata.
RAII object to check and reserve a wallet rescan.
std::string ToString() const
std::string GetHex() const
Path class wrapper to block calls to the fs::path(std::string) implicit constructor and the fs::path:...
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
virtual CBlockLocator getTipLocator()=0
Get locator for the current chain tip.
virtual std::optional< int > getHeight()=0
Get current chain height, not including genesis block (returns 0 if chain only contains genesis block...
virtual BlockHash getBlockHash(int height)=0
Get block hash. Height must be valid or this function will abort.
virtual bool findBlock(const BlockHash &hash, const FoundBlock &block={})=0
Return whether node has the block and optionally return block metadata or contents.
virtual bool updateRwSetting(const std::string &name, const util::SettingsValue &value, bool write=true)=0
Write a setting to <datadir>/settings.json.
virtual bool findFirstBlockWithTimeAndHeight(int64_t min_time, int min_height, const FoundBlock &block={})=0
Find first block in the chain with timestamp >= the given time and height >= than the given height,...
virtual bool broadcastTransaction(const Config &config, const CTransactionRef &tx, const Amount &max_tx_fee, bool relay, std::string &err_string)=0
Transaction is added to memory pool, if the transaction fee is below the amount specified by max_tx_f...
virtual util::SettingsValue getRwSetting(const std::string &name)=0
Return <datadir>/settings.json setting value.
virtual double guessVerificationProgress(const BlockHash &block_hash)=0
Estimate fraction of total transactions verified if blocks up to the specified block hash are verifie...
virtual const CChainParams & params() const =0
This Chain's parameters.
virtual bool havePruned()=0
Check if any block has been pruned.
virtual bool findAncestorByHeight(const BlockHash &block_hash, int ancestor_height, const FoundBlock &ancestor_out={})=0
Find ancestor of block at specified height and optionally return ancestor information.
virtual void initMessage(const std::string &message)=0
Send init message.
virtual std::optional< int > findLocatorFork(const CBlockLocator &locator)=0
Return height of the highest block on chain in common with the locator, which will either be the orig...
virtual bool haveBlockOnDisk(int height)=0
Check that the block is available on disk (i.e.
virtual void requestMempoolTransactions(Notifications ¬ifications)=0
Synchronously send transactionAddedToMempool notifications about all current mempool transactions to ...
virtual void waitForNotificationsIfTipChanged(const BlockHash &old_tip)=0
Wait for pending notifications to be processed unless block hash points to the current chain tip.
virtual CFeeRate relayMinFee()=0
Relay current minimum fee (from -minrelaytxfee settings).
Helper for findBlock to selectively return pieces of block data.
FoundBlock & height(int &height)
void memory_cleanse(void *ptr, size_t len)
Secure overwrite a buffer (possibly containing secret data) with zero-bytes.
const Config & GetConfig()
static const int COINBASE_MATURITY
Coinbase transaction outputs can only be spent after this number of new blocks (network rule).
const unsigned int WALLET_CRYPTO_SALT_SIZE
std::vector< uint8_t, secure_allocator< uint8_t > > CKeyingMaterial
const unsigned int WALLET_CRYPTO_KEY_SIZE
bilingual_str AmountHighWarn(const std::string &optname)
bilingual_str AmountErrMsg(const std::string &optname, const std::string &strValue)
void LockCoin(const COutPoint &output) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
void MarkDestinationsDirty(const std::set< CTxDestination > &destinations) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Marks all outputs in each one of the destinations dirty, so their cache is reset and does not return ...
size_t KeypoolCountExternalKeys() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
void KeepDestination()
Keep the address.
void ListLockedCoins(std::vector< COutPoint > &vOutpts) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
unsigned int GetKeyPoolSize() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
std::set< CTxDestination > GetLabelAddresses(const std::string &label) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
bool IsLockedCoin(const COutPoint &outpoint) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
SigningResult SignMessage(const std::string &message, const PKHash &pkhash, std::string &str_sig) const
void UnlockCoin(const COutPoint &output) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
bool SetAddressBook(const CTxDestination &address, const std::string &strName, const std::string &purpose)
DBErrors LoadWallet(bool &fFirstRunRet)
OutputType TransactionChangeType(const std::optional< OutputType > &change_type, const std::vector< CRecipient > &vecSend) const
bool SignTransaction(CMutableTransaction &tx) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
void ReturnDestination()
Return reserved address.
bool GetNewChangeDestination(const OutputType type, CTxDestination &dest, std::string &error)
void UnlockAllCoins() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
bool TopUpKeyPool(unsigned int kpSize=0)
bool SetAddressBookWithDB(WalletBatch &batch, const CTxDestination &address, const std::string &strName, const std::string &strPurpose)
TransactionError FillPSBT(PartiallySignedTransaction &psbtx, bool &complete, SigHashType sighash_type=SigHashType().withForkId(), bool sign=true, bool bip32derivs=true) const
Fills out a PSBT with information from the wallet.
bool GetReservedDestination(CTxDestination &pubkey, bool internal)
Reserve an address.
int64_t GetOldestKeyPoolTime() const
bool DelAddressBook(const CTxDestination &address)
bool GetNewDestination(const OutputType type, const std::string label, CTxDestination &dest, std::string &error)
DBErrors ZapSelectTx(std::vector< TxId > &txIdsIn, std::vector< TxId > &txIdsOut) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
void CommitTransaction(CTransactionRef tx, mapValue_t mapValue, std::vector< std::pair< std::string, std::string > > orderForm, bool broadcast=true)
Add the transaction to the wallet and maybe attempt to broadcast it.
bool AddWalletFlags(uint64_t flags)
Overwrite all flags by the given uint64_t.
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_wallet)
void blockConnected(const CBlock &block, int height) override
bool LoadToWallet(const TxId &txid, const UpdateWalletTxFn &fill_wtx) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
void MarkConflicted(const BlockHash &hashBlock, int conflicting_height, const TxId &txid)
Mark a transaction (and its in-wallet descendants) as conflicting with a particular block.
void Flush()
Flush wallet (bitdb flush)
void UpgradeKeyMetadata() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Upgrade stored CKeyMetadata objects to store key origin info as KeyOriginInfo.
bool SetMaxVersion(int nVersion)
change which version we're allowed to upgrade to (note that this does not immediately imply upgrading...
std::set< TxId > GetConflicts(const TxId &txid) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Get wallet transactions that conflict with given transaction (spend same outputs)
bool SubmitTxMemoryPoolAndRelay(const CWalletTx &wtx, std::string &err_string, bool relay) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Pass this transaction to node for mempool insertion and relay to peers if flag set to true.
void AddToSpends(const COutPoint &outpoint, const TxId &wtxid) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
void SyncTransaction(const CTransactionRef &tx, CWalletTx::Confirmation confirm, bool update_tx=true) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Used by TransactionAddedToMemorypool/BlockConnected/Disconnected/ScanForWalletTransactions.
bool ImportScripts(const std::set< CScript > scripts, int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
CWalletTx * AddToWallet(CTransactionRef tx, const CWalletTx::Confirmation &confirm, const UpdateWalletTxFn &update_wtx=nullptr, bool fFlushOnClose=true)
bool HasWalletSpend(const TxId &txid) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Check if a given transaction has any of its outputs spent by another transaction in the wallet.
bool ChangeWalletPassphrase(const SecureString &strOldWalletPassphrase, const SecureString &strNewWalletPassphrase)
void BlockUntilSyncedToCurrentChain() const LOCKS_EXCLUDED(void SetWalletFlag(uint64_t flags)
Blocks until the wallet state is up-to-date to /at least/ the current chain at the time this function...
bool IsFromMe(const CTransaction &tx) const
should probably be renamed to IsRelevantToMe
bool ImportPrivKeys(const std::map< CKeyID, CKey > &privkey_map, const int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
isminetype IsMine(const CTxDestination &dest) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
bool LoadWalletFlags(uint64_t flags)
Loads the flags into the wallet.
bool ImportScriptPubKeys(const std::string &label, const std::set< CScript > &script_pub_keys, const bool have_solving_data, const bool apply_label, const int64_t timestamp) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
bool CanGetAddresses(bool internal=false) const
Returns true if the wallet can give out new addresses.
ScanResult ScanForWalletTransactions(const BlockHash &start_block, int start_height, std::optional< int > max_height, const WalletRescanReserver &reserver, bool fUpdate)
Scan the block chain (starting in start_block) for transactions from or to us.
bool IsSpentKey(const TxId &txid, unsigned int n) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
bool TransactionCanBeAbandoned(const TxId &txid) const
Return whether transaction can be abandoned.
const CChainParams & GetChainParams() const override
Amount GetDebit(const CTxIn &txin, const isminefilter &filter) const
Returns amount of debit if the input matches the filter, otherwise returns 0.
void MarkInputsDirty(const CTransactionRef &tx) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Mark a transaction's inputs dirty, thus forcing the outputs to be recomputed.
bool AddToWalletIfInvolvingMe(const CTransactionRef &tx, CWalletTx::Confirmation confirm, bool fUpdate) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Add a transaction to the wallet, or update it.
bool IsSpent(const COutPoint &outpoint) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Outpoint is spent if any non-conflicted transaction, spends it:
void ReacceptWalletTransactions() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
void UnsetWalletFlagWithDB(WalletBatch &batch, uint64_t flag)
Unsets a wallet flag and saves it to disk.
void SyncMetaData(std::pair< TxSpends::iterator, TxSpends::iterator >) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
bool EncryptWallet(const SecureString &strWalletPassphrase)
void updatedBlockTip() override
void UnsetWalletFlag(uint64_t flag)
Unsets a single wallet flag.
void transactionRemovedFromMempool(const CTransactionRef &tx, MemPoolRemovalReason reason, uint64_t mempool_sequence) override
bool IsWalletFlagSet(uint64_t flag) const override
Check if a certain wallet flag is set.
int64_t RescanFromTime(int64_t startTime, const WalletRescanReserver &reserver, bool update)
Scan active chain for relevant transactions after importing keys.
bool AbandonTransaction(const TxId &txid)
Mark a transaction (and it in-wallet descendants) as abandoned so its inputs may be respent.
void UnsetBlankWalletFlag(WalletBatch &batch) override
Unset the blank wallet flag and saves it to disk.
void SetSpentKeyState(WalletBatch &batch, const TxId &txid, unsigned int n, bool used, std::set< CTxDestination > &tx_destinations) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
void transactionAddedToMempool(const CTransactionRef &tx, uint64_t mempool_sequence) override
DBErrors ReorderTransactions()
void blockDisconnected(const CBlock &block, int height) override
void Close()
Close wallet database.
int64_t IncOrderPosNext(WalletBatch *batch=nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Increment the next transaction order id.
const CWalletTx * GetWalletTx(const TxId &txid) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
void ResendWalletTransactions()
void SetMinVersion(enum WalletFeature, WalletBatch *batch_in=nullptr, bool fExplicit=false) override
signify that a particular wallet feature is now used.
std::set< TxId > GetTxConflicts(const CWalletTx &wtx) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
bool DummySignInput(CTxIn &tx_in, const CTxOut &txout, bool use_max_sig=false) const
void chainStateFlushed(const CBlockLocator &loc) override
isminetype
IsMine() return codes.
bool error(const char *fmt, const Args &...args)
@ PRIVATE_KEY_NOT_AVAILABLE
bool ParseMoney(const std::string &money_string, Amount &nRet)
Parse an amount denoted in full coins.
static auto quoted(const std::string &s)
static std::string PathToString(const path &path)
Convert path object to byte string.
static path PathFromString(const std::string &string)
Convert byte string to path object.
fs::path AbsPathJoin(const fs::path &base, const fs::path &path)
Helper function for joining two paths.
std::unique_ptr< Wallet > MakeWallet(const std::shared_ptr< CWallet > &wallet)
Return implementation of Wallet interface.
std::unique_ptr< Handler > MakeHandler(boost::signals2::connection connection)
Return handler wrapping a boost signal connection.
const std::string & FormatOutputType(OutputType type)
const std::array< OutputType, 1 > OUTPUT_TYPES
std::shared_ptr< const CTransaction > CTransactionRef
bool PSBTInputSigned(const PSBTInput &input)
Checks whether a PSBTInput is already signed.
void GetStrongRandBytes(Span< uint8_t > bytes) noexcept
Gather entropy from various sources, feed it into the internal PRNG, and generate random data using i...
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
std::vector< CKeyID > GetAffectedKeys(const CScript &spk, const SigningProvider &provider)
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
static std::string ToString(const CService &ip)
bool ProduceSignature(const SigningProvider &provider, const BaseSignatureCreator &creator, const CScript &fromPubKey, SignatureData &sigdata)
Produce a script signature using a generic signature creator.
void UpdateInput(CTxIn &input, const SignatureData &data)
const BaseSignatureCreator & DUMMY_MAXIMUM_SIGNATURE_CREATOR
A signature creator that just produces 72-byte empty signatures.
const BaseSignatureCreator & DUMMY_SIGNATURE_CREATOR
A signature creator that just produces 71-byte empty signatures.
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
std::variant< CNoDestination, PKHash, ScriptHash > CTxDestination
A txout script template with a specific destination.
void ReplaceAll(std::string &in_out, const std::string &search, const std::string &substitute)
static constexpr Amount zero() noexcept
A BlockHash is a unqiue identifier for a block.
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
void SetSeed(Span< const std::byte > seed)
std::optional< int > last_scanned_height
BlockHash last_scanned_block
Hash and height of most recent block that was successfully scanned.
enum CWallet::ScanResult::@20 status
BlockHash last_failed_block
Hash of the most recent block that could not be scanned due to read errors or pruning.
Confirmation includes tx status and a triplet of {block height/block hash/tx index in block} at which...
SecureString create_passphrase
A version of CTransaction with the PSBT format.
A TxId is the identifier of a transaction.
#define WAIT_LOCK(cs, name)
#define AssertLockNotHeld(cs)
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
#define AssertLockHeld(cs)
std::string ShellEscape(const std::string &arg)
int64_t GetTimeMillis()
Returns the system time (not mockable)
int64_t GetTime()
DEPRECATED Use either ClockType::now() or Now<TimePointType>() if a cast is needed.
bilingual_str _(const char *psz)
Translation function.
bilingual_str Untranslated(std::string original)
Mark a bilingual_str as untranslated.
MemPoolRemovalReason
Reason why a transaction was removed from the mempool, this is passed to the notification signal.
@ BLOCK
Removed for block.
@ CONFLICT
Removed for conflict with in-block transaction.
std::unique_ptr< WalletDatabase > MakeDatabase(const fs::path &path, const DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error)
std::map< std::string, std::string > mapValue_t
constexpr Amount HIGH_TX_FEE_PER_KB
Discourage users to set fees higher than this amount (in satoshis) per kB.
std::function< void(std::unique_ptr< interfaces::Wallet > wallet)> LoadWalletFn
constexpr OutputType DEFAULT_ADDRESS_TYPE
Default for -addresstype.
constexpr Amount HIGH_MAX_TX_FEE
-maxtxfee will warn if called with a higher fee than this amount (in satoshis)
static const bool DEFAULT_SPEND_ZEROCONF_CHANGE
Default for -spendzeroconfchange.
static constexpr uint64_t KNOWN_WALLET_FLAGS
static const bool DEFAULT_WALLETBROADCAST
constexpr Amount HIGH_APS_FEE
discourage APS fee higher than this amount
std::unique_ptr< interfaces::Handler > HandleLoadWallet(LoadWalletFn load_wallet)
bool RemoveWallet(const std::shared_ptr< CWallet > &wallet, std::optional< bool > load_on_start, std::vector< bilingual_str > &warnings)
static void ReleaseWallet(CWallet *wallet)
std::unique_ptr< WalletDatabase > MakeWalletDatabase(const std::string &name, const DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error_string)
const std::map< uint64_t, std::string > WALLET_FLAG_CAVEATS
void MaybeResendWalletTxs()
Called periodically by the schedule thread.
void UnloadWallet(std::shared_ptr< CWallet > &&wallet)
Explicitly unload and delete the wallet.
static std::condition_variable g_wallet_release_cv
static GlobalMutex g_loading_wallet_mutex
RecursiveMutex cs_wallets
bool AddWalletSetting(interfaces::Chain &chain, const std::string &wallet_name)
Add wallet name to persistent configuration so it will be loaded on startup.
bool RemoveWalletSetting(interfaces::Chain &chain, const std::string &wallet_name)
Remove wallet name from persistent configuration so it will not be loaded on startup.
static void UpdateWalletSetting(interfaces::Chain &chain, const std::string &wallet_name, std::optional< bool > load_on_startup, std::vector< bilingual_str > &warnings)
static GlobalMutex g_wallet_release_mutex
std::shared_ptr< CWallet > GetWallet(const std::string &name)
std::vector< std::shared_ptr< CWallet > > GetWallets()
bool AddWallet(const std::shared_ptr< CWallet > &wallet)
std::shared_ptr< CWallet > LoadWallet(interfaces::Chain &chain, const std::string &name, std::optional< bool > load_on_start, const DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error, std::vector< bilingual_str > &warnings)
std::shared_ptr< CWallet > CreateWallet(interfaces::Chain &chain, const std::string &name, std::optional< bool > load_on_start, const DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error, std::vector< bilingual_str > &warnings)
RecursiveMutex cs_wallets
DBErrors
Error statuses for the wallet database.
fs::path GetWalletDir()
Get the path of the wallet directory.
@ WALLET_FLAG_DISABLE_PRIVATE_KEYS
@ WALLET_FLAG_AVOID_REUSE
@ WALLET_FLAG_KEY_ORIGIN_METADATA
@ WALLET_FLAG_DESCRIPTORS
Indicate that this wallet supports DescriptorScriptPubKeyMan.
@ WALLET_FLAG_BLANK_WALLET
Flag set when a wallet contains no HD seed and no private keys, scripts, addresses,...
WalletFeature
(client) version numbers for particular wallet features
@ FEATURE_PRE_SPLIT_KEYPOOL