6 #ifndef BITCOIN_WALLET_WALLET_H
7 #define BITCOIN_WALLET_WALLET_H
48 #include <unordered_map>
52 #include <boost/signals2/signal.hpp>
77 using
LoadWalletFn = std::function<void(std::unique_ptr<interfaces::Wallet> wallet)>;
91 bool AddWallet(WalletContext& context,
const std::shared_ptr<CWallet>&
wallet);
92 bool RemoveWallet(WalletContext& context,
const std::shared_ptr<CWallet>&
wallet, std::optional<bool> load_on_start, std::vector<bilingual_str>& warnings);
93 bool RemoveWallet(WalletContext& context,
const std::shared_ptr<CWallet>&
wallet, std::optional<bool> load_on_start);
94 std::vector<std::shared_ptr<CWallet>>
GetWallets(WalletContext& context);
96 std::shared_ptr<CWallet>
GetWallet(WalletContext& context,
const std::string&
name);
97 std::shared_ptr<CWallet>
LoadWallet(WalletContext& context,
const std::string&
name, std::optional<bool> load_on_start,
const DatabaseOptions& options,
DatabaseStatus& status,
bilingual_str& error, std::vector<bilingual_str>& warnings);
98 std::shared_ptr<CWallet>
CreateWallet(WalletContext& context,
const std::string&
name, std::optional<bool> load_on_start, DatabaseOptions& options,
DatabaseStatus& status,
bilingual_str& error, std::vector<bilingual_str>& warnings);
99 std::shared_ptr<CWallet>
RestoreWallet(WalletContext& context,
const fs::path& backup_file,
const std::string& wallet_name, std::optional<bool> load_on_start,
DatabaseStatus& status,
bilingual_str& error, std::vector<bilingual_str>& warnings);
201 bool fInternal{
false};
221 void ReturnDestination();
223 void KeepDestination();
254 bool previously_spent{
false};
263 std::map<std::string, std::string> receive_requests{};
266 bool IsChange()
const {
return !label.has_value(); }
267 std::string
GetLabel()
const {
return label ? *label : std::string{}; }
307 std::atomic<bool> fAbortRescan{
false};
308 std::atomic<bool> fScanningWallet{
false};
309 std::atomic<bool> m_attaching_chain{
false};
310 std::atomic<bool> m_scanning_with_passphrase{
false};
311 std::atomic<SteadyClock::time_point> m_scanning_start{SteadyClock::time_point{}};
312 std::atomic<double> m_scanning_progress{0};
322 bool fBroadcastTransactions =
false;
324 std::atomic<int64_t> m_best_block_time {0};
328 std::atomic<int64_t> m_birth_time{std::numeric_limits<int64_t>::max()};
335 typedef std::unordered_multimap<COutPoint, uint256, SaltedOutpointHasher>
TxSpends;
359 void MarkConflicted(const
uint256& hashBlock,
int conflicting_height, const
uint256& hashTx);
361 enum class
TxUpdate { UNCHANGED, CHANGED, NOTIFY_CHANGED };
376 std::atomic<uint64_t> m_wallet_flags{0};
378 bool SetAddressBookWithDB(
WalletBatch& batch,
const CTxDestination& address,
const std::string& strName,
const std::optional<AddressPurpose>& strPurpose);
381 void UnsetWalletFlagWithDB(
WalletBatch& batch, uint64_t flag);
384 void UnsetBlankWalletFlag(
WalletBatch& batch)
override;
409 int m_last_block_processed_height
GUARDED_BY(cs_wallet) = -1;
420 void AddScriptPubKeyMan(
const uint256&
id, std::unique_ptr<ScriptPubKeyMan> spkm_man);
433 static bool AttachChain(
const std::shared_ptr<CWallet>&
wallet,
interfaces::Chain& chain,
const bool rescan_required,
bilingual_str& error, std::vector<bilingual_str>& warnings);
446 assert(
static_cast<bool>(m_database));
452 const std::string&
GetName()
const {
return m_name; }
456 unsigned int nMasterKeyMaxID = 0;
462 m_database(
std::move(database))
472 bool IsCrypted()
const;
473 bool IsLocked()
const override;
477 bool HaveChain()
const {
return m_chain ? true :
false; }
481 std::unordered_map<uint256, CWalletTx, SaltedTxidHasher> mapWallet
GUARDED_BY(cs_wallet);
483 typedef std::multimap<int64_t, CWalletTx*>
TxItems;
488 std::map<CTxDestination, CAddressBookData> m_address_book
GUARDED_BY(cs_wallet);
524 return GetTxDepthInMainChain(wtx) > 0;
556 void AbortRescan() { fAbortRescan =
true; }
560 SteadyClock::duration
ScanningDuration()
const {
return fScanningWallet ? SteadyClock::now() - m_scanning_start.load() : SteadyClock::duration{}; }
561 double ScanningProgress()
const {
return fScanningWallet ? (double) m_scanning_progress : 0; }
585 bool ChangeWalletPassphrase(
const SecureString& strOldWalletPassphrase,
const SecureString& strNewWalletPassphrase);
586 bool EncryptWallet(
const SecureString& strWalletPassphrase);
589 unsigned int ComputeTimeSmart(
const CWalletTx& wtx,
bool rescanning_old_block)
const;
616 void blockDisconnected(const
interfaces::BlockInfo& block) override;
617 void updatedBlockTip() override;
635 ScanResult ScanForWalletTransactions(
const uint256& start_block,
int start_height, std::optional<int> max_height,
const WalletRescanReserver& reserver,
bool fUpdate,
const bool save_progress);
640 bool ShouldResend()
const;
641 void ResubmitWalletTransactions(
bool relay,
bool force);
643 OutputType TransactionChangeType(
const std::optional<OutputType>& change_type,
const std::vector<CRecipient>& vecSend)
const;
649 SigningResult SignMessage(
const std::string& message,
const PKHash& pkhash, std::string& str_sig)
const;
670 bool bip32derivs =
true,
671 size_t* n_signed =
nullptr,
672 bool finalize =
true)
const;
686 bool SubmitTxMemoryPoolAndRelay(
CWalletTx& wtx, std::string& err_string,
bool relay)
const
690 bool ImportPrivKeys(
const std::map<CKeyID, CKey>& privkey_map,
const int64_t timestamp)
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
691 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);
692 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);
695 void MaybeUpdateBirthTime(int64_t time);
703 bool m_allow_fallback_fee{
true};
731 std::optional<OutputType> m_default_change_type{};
742 bool TopUpKeyPool(
unsigned int kpSize = 0);
744 std::optional<int64_t> GetOldestKeyPoolTime() const;
749 std::optional<std::string> m_op_label{std::nullopt};
751 bool ignore_change{
true};
757 std::vector<CTxDestination> ListAddrBookAddresses(
const std::optional<AddrBookFilter>& filter)
const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
762 std::set<std::string> ListAddrBookLabels(
const std::optional<AddressPurpose> purpose)
const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
800 bool SetAddressBook(
const CTxDestination& address,
const std::string& strName,
const std::optional<AddressPurpose>& purpose);
818 int GetVersion()
const {
LOCK(cs_wallet);
return nWalletVersion; }
840 const std::string& label,
bool isMine,
851 boost::signals2::signal<void (
const std::string &title,
int nProgress)>
ShowProgress;
871 bool TransactionCanBeAbandoned(
const uint256& hashTx)
const;
874 bool AbandonTransaction(
const uint256& hashTx);
877 bool MarkReplaced(
const uint256& originalHash,
const uint256& newHash);
880 static std::shared_ptr<CWallet> Create(
WalletContext& context,
const std::string&
name, std::unique_ptr<WalletDatabase> database, uint64_t wallet_creation_flags,
bilingual_str& error, std::vector<bilingual_str>& warnings);
886 void postInitProcess();
888 bool BackupWallet(
const std::string& strDest)
const;
891 bool IsHDEnabled()
const;
894 bool CanGetAddresses(
bool internal =
false)
const;
908 void SetWalletFlag(uint64_t
flags);
911 void UnsetWalletFlag(uint64_t flag);
914 bool IsWalletFlagSet(uint64_t flag) const override;
919 void InitWalletFlags(uint64_t
flags);
924 bool IsLegacy() const;
927 std::
string GetDisplayName()
const override
929 std::string wallet_name = GetName().length() == 0 ?
"default wallet" : GetName();
934 template <
typename...
Params>
937 LogPrintf((
"%s " + std::string{fmt}).c_str(), GetDisplayName(), parameters...);
944 std::set<ScriptPubKeyMan*> GetActiveScriptPubKeyMans()
const;
947 std::set<ScriptPubKeyMan*> GetAllScriptPubKeyMans()
const;
953 std::set<ScriptPubKeyMan*> GetScriptPubKeyMans(
const CScript& script)
const;
958 std::unique_ptr<SigningProvider> GetSolvingProvider(
const CScript& script)
const;
959 std::unique_ptr<SigningProvider> GetSolvingProvider(
const CScript& script,
SignatureData& sigdata)
const;
962 std::vector<WalletDescriptor> GetWalletDescriptors(
const CScript& script)
const;
969 void SetupLegacyScriptPubKeyMan();
971 bool WithEncryptionKey(std::function<
bool (
const CKeyingMaterial&)> cb)
const override;
973 bool HasEncryptionKeys()
const override;
979 assert(m_last_block_processed_height >= 0);
980 return m_last_block_processed_height;
985 assert(m_last_block_processed_height >= 0);
986 return m_last_block_processed;
992 m_last_block_processed_height = block_height;
993 m_last_block_processed = block_hash;
997 void ConnectScriptPubKeyManNotifiers();
1050 bool CanGrindR() const;
1068 using Clock = std::chrono::steady_clock;
1069 using NowFn = std::function<Clock::time_point()>;
1071 bool m_could_reserve{
false};
1078 assert(!m_could_reserve);
1079 if (
m_wallet.fScanningWallet.exchange(
true)) {
1082 m_wallet.m_scanning_with_passphrase.exchange(with_passphrase);
1083 m_wallet.m_scanning_start = SteadyClock::now();
1085 m_could_reserve =
true;
1091 return (m_could_reserve &&
m_wallet.fScanningWallet);
1094 Clock::time_point
now()
const {
return m_now ? m_now() : Clock::now(); };
1100 if (m_could_reserve) {
1102 m_wallet.m_scanning_with_passphrase =
false;
std::variant< CNoDestination, PubKeyDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, WitnessUnknown > CTxDestination
A txout script categorized into standard templates.
int64_t CAmount
Amount in satoshis (Can be negative)
static constexpr CAmount COIN
The amount of satoshis in one BTC.
const CChainParams & Params()
Return the currently selected parameters.
Fee rate in satoshis per kilovirtualbyte: CAmount / kvB.
An encapsulated private key.
A reference to a CKey: the Hash160 of its serialized public key.
An outpoint - a combination of a transaction hash and an index n into its vout.
An encapsulated public key.
Serialized script, used inside transaction inputs and outputs.
The basic transaction that is broadcasted on the network and contained in blocks.
An input of a transaction.
An output of a transaction.
An interface to be implemented by keystores that support signing.
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...
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
const std::string & GetName() const
Get a name for this wallet for logging/debugging purposes.
bool HaveChain() const
Interface to assert chain access.
bool GetBroadcastTransactions() const
Inquire whether this wallet broadcasts transactions.
int64_t GetBirthTime() const
std::function< bool(CWalletTx &wtx, bool new_tx)> UpdateWalletTxFn
Callback for updating transaction metadata in mapWallet.
boost::signals2::signal< void()> NotifyUnload
Wallet is about to be unloaded.
int m_last_block_processed_height GUARDED_BY(cs_wallet)
Height of last block processed is used by wallet to know depth of transactions without relying on Cha...
std::unique_ptr< WalletDatabase > m_database
Internal database handle.
CWallet(interfaces::Chain *chain, const std::string &name, std::unique_ptr< WalletDatabase > database)
Construct wallet with specified name and database implementation.
std::function< void(const CTxDestination &dest, const std::string &label, bool is_change, const std::optional< AddressPurpose > purpose)> ListAddrBookFunc
Walk-through the address book entries.
std::map< CTxDestination, CAddressBookData > m_address_book GUARDED_BY(cs_wallet)
int GetLastBlockHeight() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Get last block processed height.
boost::signals2::signal< void(bool fHaveWatchOnly)> NotifyWatchonlyChanged
Watch-only address added.
WalletDatabase & GetDatabase() const override
std::map< OutputType, ScriptPubKeyMan * > m_external_spk_managers
uint256 m_last_block_processed GUARDED_BY(cs_wallet)
The following is used to keep track of how far behind the wallet is from the chain sync,...
CKeyingMaterial vMasterKey GUARDED_BY(cs_wallet)
void SetBroadcastTransactions(bool broadcast)
Set whether this wallet broadcasts transactions.
int64_t nOrderPosNext GUARDED_BY(cs_wallet)=0
std::map< OutputType, ScriptPubKeyMan * > m_internal_spk_managers
std::string m_name
Wallet name: relative directory name or "" for default wallet.
double ScanningProgress() const
SteadyClock::duration ScanningDuration() const
RecursiveMutex m_relock_mutex
std::string m_notify_tx_changed_script
Notify external script when a wallet transaction comes in or is updated (handled by -walletnotify)
void SetNextResend()
Set the next time this wallet should resend transactions to 12-36 hours from now, ~1 day on average.
bool CanSupportFeature(enum WalletFeature wf) const override EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
check whether we support the named feature
MasterKeyMap mapMasterKeys
void WalletLogPrintf(const char *fmt, Params... parameters) const
Prepends the wallet name in logging output to ease debugging in multi-wallet use cases.
int64_t nRelockTime GUARDED_BY(cs_wallet)
Holds a timestamp at which point the wallet is scheduled (externally) to be relocked....
std::unordered_multimap< COutPoint, uint256, SaltedOutpointHasher > TxSpends
Used to keep track of spent outpoints, and detect and report conflicts (double-spends or mutated tran...
boost::signals2::signal< void(const std::string &title, int nProgress)> ShowProgress
Show progress e.g.
interfaces::Chain * m_chain
Interface for accessing chain state.
boost::signals2::signal< void(const uint256 &hashTx, ChangeType status)> NotifyTransactionChanged
Wallet transaction added, removed or updated.
std::map< unsigned int, CMasterKey > MasterKeyMap
boost::signals2::signal< void()> NotifyCanGetAddressesChanged
Keypool has new keys.
TxSpends mapTxSpends GUARDED_BY(cs_wallet)
bool IsTxInMainChain(const CWalletTx &wtx) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
int nWalletVersion GUARDED_BY(cs_wallet)
the current wallet version: clients below this version are not able to load the wallet
bool IsAbortingRescan() const
void SetLastBlockProcessed(int block_height, uint256 block_hash) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
Set last block processed height, currently only use in unit test.
uint256 GetLastBlockHash() const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet)
RecursiveMutex cs_wallet
Main wallet lock.
std::unordered_map< CScript, std::vector< ScriptPubKeyMan * >, SaltedSipHasher > m_cached_spks
Cache of descriptor ScriptPubKeys used for IsMine. Maps ScriptPubKey to set of spkms.
boost::signals2::signal< void(const CTxDestination &address, const std::string &label, bool isMine, AddressPurpose purpose, ChangeType status)> NotifyAddressBookChanged
Address book entry changed.
std::multimap< int64_t, CWalletTx * > TxItems
boost::signals2::signal< void(CWallet *wallet)> NotifyStatusChanged
Wallet status (encrypted, locked) changed.
std::map< uint256, std::unique_ptr< ScriptPubKeyMan > > m_spk_managers
std::function< TxUpdate(CWalletTx &wtx)> TryUpdatingStateFn
std::unordered_map< uint256, CWalletTx, SaltedTxidHasher > mapWallet GUARDED_BY(cs_wallet)
Map from txid to CWalletTx for all transactions this wallet is interested in, including received and ...
bool IsScanningWithPassphrase() const
A transaction with a bunch of additional info that only the owner cares about.
A wrapper to reserve an address from a wallet.
const CWallet *const pwallet
The wallet to reserve from.
CTxDestination address
The destination.
ReserveDestination & operator=(const ReserveDestination &)=delete
~ReserveDestination()
Destructor. If a key has been reserved and not KeepKey'ed, it will be returned to the keypool.
ReserveDestination(CWallet *pwallet, OutputType type)
Construct a ReserveDestination object. This does NOT reserve an address yet.
ReserveDestination(const ReserveDestination &)=delete
Access to the wallet database.
An instance of this class represents one database.
Descriptor with some wallet metadata.
RAII object to check and reserve a wallet rescan.
std::function< Clock::time_point()> NowFn
std::chrono::steady_clock Clock
WalletRescanReserver(CWallet &w)
Clock::time_point now() const
bool reserve(bool with_passphrase=false)
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
@ SIGHASH_DEFAULT
Taproot only; implied when sighash byte is missing, and equivalent to SIGHASH_ALL.
ChainstateRole
This enum describes the various roles a specific Chainstate instance can take.
MemPoolRemovalReason
Reason why a transaction was removed from the mempool, this is passed to the notification signal.
Result CommitTransaction(CWallet &wallet, const uint256 &txid, CMutableTransaction &&mtx, std::vector< bilingual_str > &errors, uint256 &bumped_txid)
Commit the bumpfee transaction.
static constexpr size_t DUMMY_NESTED_P2WPKH_INPUT_SIZE
Pre-calculated constants for input size estimation in virtual size
void UnloadWallet(std::shared_ptr< CWallet > &&wallet)
Explicitly unload and delete the wallet.
constexpr CAmount HIGH_APS_FEE
discourage APS fee higher than this amount
std::shared_ptr< CWallet > LoadWallet(WalletContext &context, const std::string &name, std::optional< bool > load_on_start, const DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error, std::vector< bilingual_str > &warnings)
static const CAmount DEFAULT_FALLBACK_FEE
-fallbackfee default
void MaybeResendWalletTxs(WalletContext &context)
Called periodically by the schedule thread.
std::variant< TxStateConfirmed, TxStateInMempool, TxStateInactive > SyncTxState
Subset of states transaction sync logic is implemented to handle.
std::vector< std::shared_ptr< CWallet > > GetWallets(WalletContext &context)
constexpr CAmount DEFAULT_TRANSACTION_MAXFEE
-maxtxfee default
std::map< std::string, std::string > mapValue_t
std::vector< unsigned char, secure_allocator< unsigned char > > CKeyingMaterial
static const CAmount DEFAULT_DISCARD_FEE
-discardfee default
DBErrors
Error statuses for the wallet database.
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 DBErrors LoadWalletFlags(CWallet *pwallet, DatabaseBatch &batch) EXCLUSIVE_LOCKS_REQUIRED(pwallet -> cs_wallet)
static std::set< std::string > g_loading_wallet_set GUARDED_BY(g_loading_wallet_mutex)
static const bool DEFAULT_WALLETCROSSCHAIN
std::unique_ptr< interfaces::Handler > HandleLoadWallet(WalletContext &context, LoadWalletFn load_wallet)
std::underlying_type< isminetype >::type isminefilter
used for bitflags of isminetype
static const CAmount DEFAULT_TRANSACTION_MINFEE
-mintxfee default
static const unsigned int DEFAULT_KEYPOOL_SIZE
Default for -keypool.
util::Result< MigrationResult > MigrateLegacyToDescriptor(const std::string &wallet_name, const SecureString &passphrase, WalletContext &context)
Do all steps to migrate a legacy wallet to a descriptor wallet.
static const bool DEFAULT_WALLET_RBF
-walletrbf default
constexpr CAmount HIGH_TX_FEE_PER_KB
Discourage users to set fees higher than this amount (in satoshis) per kB.
constexpr OutputType DEFAULT_ADDRESS_TYPE
Default for -addresstype.
std::unique_ptr< WalletDatabase > MakeWalletDatabase(const std::string &name, const DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error_string)
void NotifyWalletLoaded(WalletContext &context, const std::shared_ptr< CWallet > &wallet)
constexpr CAmount HIGH_MAX_TX_FEE
-maxtxfee will warn if called with a higher fee than this amount (in satoshis)
constexpr CAmount DEFAULT_PAY_TX_FEE
-paytxfee default
static const bool DEFAULT_DISABLE_WALLET
static const std::map< std::string, WalletFlags > WALLET_FLAG_MAP
static const CAmount DEFAULT_MAX_AVOIDPARTIALSPEND_FEE
maximum fee increase allowed to do partial spend avoidance, even for nodes with this feature disabled...
static const unsigned int DEFAULT_TX_CONFIRM_TARGET
-txconfirmtarget default
isminetype
IsMine() return codes, which depend on ScriptPubKeyMan implementation.
std::string PurposeToString(AddressPurpose p)
AddressPurpose
Address purpose field that has been been stored with wallet sending and receiving addresses since BIP...
@ REFUND
Never set in current code may be present in older wallet databases.
static const bool DEFAULT_WALLETBROADCAST
std::shared_ptr< CWallet > RestoreWallet(WalletContext &context, const fs::path &backup_file, const std::string &wallet_name, std::optional< bool > load_on_start, DatabaseStatus &status, bilingual_str &error, std::vector< bilingual_str > &warnings)
bool AddWallet(WalletContext &context, const std::shared_ptr< CWallet > &wallet)
static const CAmount WALLET_INCREMENTAL_RELAY_FEE
minimum recommended increment for replacement txs
WalletFeature
(client) version numbers for particular wallet features
static constexpr uint64_t KNOWN_WALLET_FLAGS
static const CAmount DEFAULT_CONSOLIDATE_FEERATE
-consolidatefeerate default
std::shared_ptr< CWallet > CreateWallet(WalletContext &context, const std::string &name, std::optional< bool > load_on_start, DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error, std::vector< bilingual_str > &warnings)
bool IsFeatureSupported(int wallet_version, int feature_version)
@ 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,...
static constexpr uint64_t MUTABLE_WALLET_FLAGS
std::shared_ptr< CWallet > GetWallet(WalletContext &context, const std::string &name)
static const bool DEFAULT_SPEND_ZEROCONF_CHANGE
Default for -spendzeroconfchange.
std::variant< TxStateConfirmed, TxStateInMempool, TxStateConflicted, TxStateInactive, TxStateUnrecognized > TxState
All possible CWalletTx states.
std::optional< AddressPurpose > PurposeFromString(std::string_view s)
static const bool DEFAULT_WALLET_REJECT_LONG_CHAINS
Default for -walletrejectlongchains.
static DBErrors LoadMinVersion(CWallet *pwallet, DatabaseBatch &batch) EXCLUSIVE_LOCKS_REQUIRED(pwallet -> cs_wallet)
bool RemoveWallet(WalletContext &context, const std::shared_ptr< CWallet > &wallet, std::optional< bool > load_on_start, std::vector< bilingual_str > &warnings)
std::shared_ptr< CWallet > GetDefaultWallet(WalletContext &context, size_t &count)
std::shared_ptr< const CTransaction > CTransactionRef
void SignTransaction(CMutableTransaction &mtx, const SigningProvider *keystore, const std::map< COutPoint, Coin > &coins, const UniValue &hashType, UniValue &result)
Sign a transaction with the given keystore and previous transactions.
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
A mutable version of CTransaction.
std::chrono::time_point< NodeClock > time_point
A version of CTransaction with the PSBT format.
std::optional< AddressPurpose > purpose
Address purpose which was originally recorded for payment protocol support but now serves as a cached...
void SetLabel(std::string name)
std::string GetLabel() const
std::optional< std::string > label
Address label which is always nullopt for change addresses.
bool IsChange() const
Accessor methods.
bool fSubtractFeeFromAmount
std::optional< int > last_scanned_height
uint256 last_scanned_block
Hash and height of most recent block that was successfully scanned.
uint256 last_failed_block
Height of the most recent block that could not be scanned due to read errors or pruning.
struct containing information needed for migrating legacy wallets to descriptor wallets
std::shared_ptr< CWallet > watchonly_wallet
std::shared_ptr< CWallet > solvables_wallet
std::shared_ptr< CWallet > wallet
WalletContext struct containing references to state shared between CWallet instances,...
#define EXCLUSIVE_LOCKS_REQUIRED(...)
#define LOCKS_EXCLUDED(...)
ChangeType
General change type (added, updated, removed).
std::shared_ptr< CWallet > m_wallet
std::function< void(std::unique_ptr< interfaces::Wallet > wallet)> LoadWalletFn
static void NotifyUnload(WalletModel *walletModel)