6 #ifndef BITCOIN_WALLET_WALLET_H
7 #define BITCOIN_WALLET_WALLET_H
48 #include <unordered_map>
52 #include <boost/signals2/signal.hpp>
79 using
LoadWalletFn = std::function<void(std::unique_ptr<interfaces::Wallet> wallet)>;
93 bool AddWallet(WalletContext& context,
const std::shared_ptr<CWallet>&
wallet);
94 bool RemoveWallet(WalletContext& context,
const std::shared_ptr<CWallet>&
wallet, std::optional<bool> load_on_start, std::vector<bilingual_str>& warnings);
95 bool RemoveWallet(WalletContext& context,
const std::shared_ptr<CWallet>&
wallet, std::optional<bool> load_on_start);
96 std::vector<std::shared_ptr<CWallet>>
GetWallets(WalletContext& context);
98 std::shared_ptr<CWallet>
GetWallet(WalletContext& context,
const std::string&
name);
99 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);
100 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);
101 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);
203 bool fInternal{
false};
223 void ReturnDestination();
225 void KeepDestination();
256 bool previously_spent{
false};
265 std::map<std::string, std::string> receive_requests{};
268 bool IsChange()
const {
return !label.has_value(); }
269 std::string
GetLabel()
const {
return label ? *label : std::string{}; }
309 std::atomic<bool> fAbortRescan{
false};
310 std::atomic<bool> fScanningWallet{
false};
311 std::atomic<bool> m_attaching_chain{
false};
312 std::atomic<bool> m_scanning_with_passphrase{
false};
313 std::atomic<SteadyClock::time_point> m_scanning_start{SteadyClock::time_point{}};
314 std::atomic<double> m_scanning_progress{0};
324 bool fBroadcastTransactions =
false;
326 std::atomic<int64_t> m_best_block_time {0};
330 std::atomic<int64_t> m_birth_time{std::numeric_limits<int64_t>::max()};
337 typedef std::unordered_multimap<COutPoint, uint256, SaltedOutpointHasher>
TxSpends;
361 void MarkConflicted(const
uint256& hashBlock,
int conflicting_height, const
uint256& hashTx);
363 enum class
TxUpdate { UNCHANGED, CHANGED, NOTIFY_CHANGED };
379 std::atomic<uint64_t> m_wallet_flags{0};
381 bool SetAddressBookWithDB(
WalletBatch& batch,
const CTxDestination& address,
const std::string& strName,
const std::optional<AddressPurpose>& strPurpose);
384 void UnsetWalletFlagWithDB(
WalletBatch& batch, uint64_t flag);
387 void UnsetBlankWalletFlag(
WalletBatch& batch)
override;
412 int m_last_block_processed_height
GUARDED_BY(cs_wallet) = -1;
423 void AddScriptPubKeyMan(
const uint256&
id, std::unique_ptr<ScriptPubKeyMan> spkm_man);
436 static bool AttachChain(
const std::shared_ptr<CWallet>&
wallet,
interfaces::Chain& chain,
const bool rescan_required,
bilingual_str& error, std::vector<bilingual_str>& warnings);
449 assert(
static_cast<bool>(m_database));
455 const std::string&
GetName()
const {
return m_name; }
459 unsigned int nMasterKeyMaxID = 0;
465 m_database(
std::move(database))
475 bool IsCrypted()
const;
476 bool IsLocked()
const override;
480 bool HaveChain()
const {
return m_chain ? true :
false; }
484 std::unordered_map<uint256, CWalletTx, SaltedTxidHasher> mapWallet
GUARDED_BY(cs_wallet);
486 typedef std::multimap<int64_t, CWalletTx*>
TxItems;
491 std::map<CTxDestination, CAddressBookData> m_address_book
GUARDED_BY(cs_wallet);
554 void AbortRescan() { fAbortRescan =
true; }
558 SteadyClock::duration
ScanningDuration()
const {
return fScanningWallet ? SteadyClock::now() - m_scanning_start.load() : SteadyClock::duration{}; }
559 double ScanningProgress()
const {
return fScanningWallet ? (double) m_scanning_progress : 0; }
583 bool ChangeWalletPassphrase(
const SecureString& strOldWalletPassphrase,
const SecureString& strNewWalletPassphrase);
584 bool EncryptWallet(
const SecureString& strWalletPassphrase);
587 unsigned int ComputeTimeSmart(
const CWalletTx& wtx,
bool rescanning_old_block)
const;
614 void blockDisconnected(const
interfaces::BlockInfo& block) override;
615 void updatedBlockTip() override;
633 ScanResult ScanForWalletTransactions(
const uint256& start_block,
int start_height, std::optional<int> max_height,
const WalletRescanReserver& reserver,
bool fUpdate,
const bool save_progress);
638 bool ShouldResend()
const;
639 void ResubmitWalletTransactions(
bool relay,
bool force);
641 OutputType TransactionChangeType(
const std::optional<OutputType>& change_type,
const std::vector<CRecipient>& vecSend)
const;
647 SigningResult SignMessage(
const std::string& message,
const PKHash& pkhash, std::string& str_sig)
const;
668 bool bip32derivs =
true,
669 size_t* n_signed =
nullptr,
670 bool finalize =
true)
const;
684 bool SubmitTxMemoryPoolAndRelay(
CWalletTx& wtx, std::string& err_string,
bool relay)
const
688 bool ImportPrivKeys(
const std::map<CKeyID, CKey>& privkey_map,
const int64_t timestamp)
EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
689 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);
690 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);
693 void MaybeUpdateBirthTime(int64_t time);
701 bool m_allow_fallback_fee{
true};
729 std::optional<OutputType> m_default_change_type{};
740 bool TopUpKeyPool(
unsigned int kpSize = 0);
742 std::optional<int64_t> GetOldestKeyPoolTime() const;
747 std::optional<std::string> m_op_label{std::nullopt};
749 bool ignore_change{
true};
755 std::vector<CTxDestination> ListAddrBookAddresses(
const std::optional<AddrBookFilter>& filter)
const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
760 std::set<std::string> ListAddrBookLabels(
const std::optional<AddressPurpose> purpose)
const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
798 bool SetAddressBook(
const CTxDestination& address,
const std::string& strName,
const std::optional<AddressPurpose>& purpose);
816 int GetVersion()
const {
LOCK(cs_wallet);
return nWalletVersion; }
838 const std::string& label,
bool isMine,
849 boost::signals2::signal<void (
const std::string &title,
int nProgress)>
ShowProgress;
869 bool TransactionCanBeAbandoned(
const uint256& hashTx)
const;
872 bool AbandonTransaction(
const uint256& hashTx);
875 bool MarkReplaced(
const uint256& originalHash,
const uint256& newHash);
878 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);
884 void postInitProcess();
886 bool BackupWallet(
const std::string& strDest)
const;
889 bool IsHDEnabled()
const;
892 bool CanGetAddresses(
bool internal =
false)
const;
906 void SetWalletFlag(uint64_t
flags);
909 void UnsetWalletFlag(uint64_t flag);
912 bool IsWalletFlagSet(uint64_t flag) const override;
917 void InitWalletFlags(uint64_t
flags);
922 bool IsLegacy() const;
925 std::
string GetDisplayName()
const override
927 std::string wallet_name = GetName().length() == 0 ?
"default wallet" : GetName();
932 template <
typename...
Params>
935 LogPrintf((
"%s " + std::string{fmt}).c_str(), GetDisplayName(), parameters...);
942 std::set<ScriptPubKeyMan*> GetActiveScriptPubKeyMans()
const;
946 std::set<ScriptPubKeyMan*> GetAllScriptPubKeyMans()
const;
952 std::set<ScriptPubKeyMan*> GetScriptPubKeyMans(
const CScript&
script)
const;
957 std::unique_ptr<SigningProvider> GetSolvingProvider(
const CScript&
script)
const;
961 std::vector<WalletDescriptor> GetWalletDescriptors(
const CScript&
script)
const;
970 void SetupLegacyScriptPubKeyMan();
972 bool WithEncryptionKey(std::function<
bool (
const CKeyingMaterial&)> cb)
const override;
974 bool HasEncryptionKeys()
const override;
980 assert(m_last_block_processed_height >= 0);
981 return m_last_block_processed_height;
986 assert(m_last_block_processed_height >= 0);
987 return m_last_block_processed;
993 m_last_block_processed_height = block_height;
994 m_last_block_processed = block_hash;
998 void ConnectScriptPubKeyManNotifiers();
1053 bool CanGrindR() const;
1078 using Clock = std::chrono::steady_clock;
1079 using NowFn = std::function<Clock::time_point()>;
1081 bool m_could_reserve{
false};
1088 assert(!m_could_reserve);
1089 if (
m_wallet.fScanningWallet.exchange(
true)) {
1092 m_wallet.m_scanning_with_passphrase.exchange(with_passphrase);
1093 m_wallet.m_scanning_start = SteadyClock::now();
1095 m_could_reserve =
true;
1101 return (m_could_reserve &&
m_wallet.fScanningWallet);
1104 Clock::time_point
now()
const {
return m_now ? m_now() : Clock::now(); };
1110 if (m_could_reserve) {
1112 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)
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::variant< TxStateConfirmed, TxStateInMempool, TxStateBlockConflicted, TxStateInactive, TxStateUnrecognized > TxState
All possible CWalletTx states.
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::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
is a home for public enum and struct type definitions that are used by internally by wallet code,...
std::function< void(std::unique_ptr< interfaces::Wallet > wallet)> LoadWalletFn
static void NotifyUnload(WalletModel *walletModel)