Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
•All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
wallet.h
Go to the documentation of this file.
97 FEATURE_BASE = 10500, // the earliest version new wallets supports (only useful for getwalletinfo's clientversion output)
101 FEATURE_HD = 120200, // Hierarchical key derivation after BIP32 (HD Wallet), BIP44 (multi-coin), BIP39 (mnemonic)
263 int GetDepthInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet); }
264 bool IsInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet) > 0; }
333 std::multimap<int64_t, std::pair<CWalletTx*, CAccountingEntry*>>::const_iterator m_it_wtxOrdered;
494 std::list<COutputEntry>& listSent, CAmount& nFee, std::string& strSentAccount, const isminefilter& filter) const;
560 // Note: CInputCoin-s are essentially inputs, their txouts are used for informational purposes only
586 COutput(const CWalletTx *txIn, int iIn, int nDepthIn, bool fSpendableIn, bool fSolvableIn, bool fSafeIn)
588 tx = txIn; i = iIn; nDepth = nDepthIn; fSpendable = fSpendableIn; fSolvable = fSolvableIn; fSafe = fSafeIn;
693 CDataStream ss(std::vector<char>(strComment.begin() + nSepPos + 1, strComment.end()), s.GetType(), s.GetVersion());
729 bool SelectCoins(const std::vector<COutput>& vAvailableCoins, const CAmount& nTargetValue, std::set<CInputCoin>& setCoinsRet, CAmount& nValueRet, const CCoinControl *coinControl = nullptr) const;
761 /* Mark a transaction (and its in-wallet descendants) as conflicting with a particular block. */
767 * Should be called with pindexBlock and posInBlock if this is for a transaction that is included in a block. */
768 void SyncTransaction(const CTransactionRef& tx, const CBlockIndex *pindex = nullptr, int posInBlock = 0);
771 void DeriveNewChildKey(WalletBatch &batch, const CKeyMetadata& metadata, CKey& secretRet, uint32_t nAccountIndex, bool fInternal /*= false*/);
863 CWallet(std::string name, std::unique_ptr<WalletDatabase> database) : m_name(std::move(name)), database(std::move(database))
917 bool CanSupportFeature(enum WalletFeature wf) const { AssertLockHeld(cs_wallet); return nWalletMaxVersion >= wf; }
922 void AvailableCoins(std::vector<COutput>& vCoins, bool fOnlySafe=true, const CCoinControl *coinControl = nullptr, const CAmount& nMinimumAmount = 1, const CAmount& nMaximumAmount = MAX_MONEY, const CAmount& nMinimumSumAmount = MAX_MONEY, const uint64_t nMaximumCount = 0, const int nMinDepth = 0, const int nMaxDepth = 9999999) const;
940 bool SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int nConfTheirs, uint64_t nMaxAncestors, std::vector<COutput> vCoins, std::set<CInputCoin>& setCoinsRet, CAmount& nValueRet, CoinType nCoinType = CoinType::ALL_COINS) const;
943 bool SelectPSInOutPairsByDenominations(int nDenom, CAmount nValueMax, std::vector< std::pair<CTxDSIn, CTxOut> >& vecPSInOutPairsRet);
947 bool SelectCoinsGroupedByAddresses(std::vector<CompactTallyItem>& vecTallyRet, bool fSkipDenominated = true, bool fAnonymizable = true, bool fSkipUnconfirmed = true, int nMaxOupointsPerAddress = -1) const;
950 bool GetMasternodeOutpointAndKeys(COutPoint& outpointRet, CPubKey& pubKeyRet, CKey& keyRet, const std::string& strTxHash = "", const std::string& strOutputIndex = "");
952 bool GetOutpointAndKeysFromOutput(const COutput& out, COutPoint& outpointRet, CPubKey& pubKeyRet, CKey& keyRet);
1000 bool LoadKey(const CKey& key, const CPubKey &pubkey) { return CCryptoKeyStore::AddKeyPubKey(key, pubkey); }
1005 bool LoadMinVersion(int nVersion) { AssertLockHeld(cs_wallet); nWalletVersion = nVersion; nWalletMaxVersion = std::max(nWalletMaxVersion, nVersion); return true; }
1009 bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret) override;
1011 bool LoadCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret);
1016 bool AddDestData(const CTxDestination &dest, const std::string &key, const std::string &value);
1020 bool LoadDestData(const CTxDestination &dest, const std::string &key, const std::string &value);
1022 bool GetDestData(const CTxDestination &dest, const std::string &key, std::string *value) const;
1037 bool ChangeWalletPassphrase(const SecureString& strOldWalletPassphrase, const SecureString& strNewWalletPassphrase);
1049 bool AccountMove(std::string strFrom, std::string strTo, CAmount nAmount, std::string strComment = "");
1050 bool GetAccountDestination(CTxDestination &dest, std::string strAccount, bool bForceNew = false);
1056 void BlockConnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex *pindex, const std::vector<CTransactionRef>& vtxConflicted) override;
1057 void BlockDisconnected(const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexDisconnected) override;
1058 bool AddToWalletIfInvolvingMe(const CTransactionRef& tx, const CBlockIndex* pIndex, int posInBlock, bool fUpdate);
1060 CBlockIndex* ScanForWalletTransactions(CBlockIndex* pindexStart, CBlockIndex* pindexStop, const WalletRescanReserver& reserver, bool fUpdate = false);
1072 CAmount GetLegacyBalance(const isminefilter& filter, int minDepth, const std::string* account, const bool fAddLocked) const;
1074 CAmount GetAnonymizableBalance(bool fSkipDenominated = false, bool fSkipUnconfirmed = true) const;
1080 bool GetBudgetSystemCollateralTX(CWalletTx& tx, uint256 hash, CAmount amount, const COutPoint& outpoint=COutPoint()/*defaults null*/);
1087 bool FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, int& nChangePosInOut, std::string& strFailReason, bool lockUnspents, const std::set<int>& setSubtractFeeFromOutputs, CCoinControl);
1095 bool CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet, int& nChangePosInOut,
1096 std::string& strFailReason, const CCoinControl& coin_control, bool sign = true, int nExtraPayloadSize = 0);
1097 bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey, CConnman* connman, CValidationState& state);
1101 void ListAccountCreditDebit(const std::string& strAccount, std::list<CAccountingEntry>& entries);
1154 bool SetAddressBook(const CTxDestination& address, const std::string& strName, const std::string& purpose);
1169 bool SetMinVersion(enum WalletFeature, WalletBatch* batch_in = nullptr, bool fExplicit = false);
1219 /* Mark a transaction (and it in-wallet descendants) as abandoned so its inputs may be respent. */
1223 static bool Verify(std::string wallet_file, bool salvage_wallet, std::string& error_string, std::string& warning_string);
1225 /* Initializes the wallet, returns a new CWallet instance or a null pointer in case of an error */
1236 bool AutoBackupWallet(const fs::path& wallet_path, std::string& strBackupWarningRet, std::string& strBackupErrorRet);
1260 void NotifyTransactionLock(const CTransaction &tx, const llmq::CInstantSendLock& islock) override;
1261 void NotifyChainLock(const CBlockIndex* pindexChainLock, const llmq::CChainLockSig& clsig) override;
std::unordered_set< const CWalletTx *, WalletTxHasher > GetSpendableTXs() const
Definition: wallet.cpp:2520
bool SelectCoinsMinConf(const CAmount &nTargetValue, int nConfMine, int nConfTheirs, uint64_t nMaxAncestors, std::vector< COutput > vCoins, std::set< CInputCoin > &setCoinsRet, CAmount &nValueRet, CoinType nCoinType=CoinType::ALL_COINS) const
Shuffle and select coins until nTargetValue is reached while avoiding small change; This method is st...
Definition: wallet.cpp:3025
std::set< std::set< CTxDestination > > GetAddressGroupings()
Definition: wallet.cpp:4614
bool GetAccountDestination(CTxDestination &dest, std::string strAccount, bool bForceNew=false)
Definition: wallet.cpp:1043
static const uint256 ABANDON_HASH
Constant used in hashBlock to indicate tx has been abandoned.
Definition: wallet.h:207
bool CanSupportFeature(enum WalletFeature wf) const
check whether we are allowed to upgrade (or already support) to the named feature ...
Definition: wallet.h:917
void SerializationOp(Stream &s, Operation ser_action)
Definition: wallet.h:662
static const bool DEFAULT_SPEND_ZEROCONF_CHANGE
Default for -spendzeroconfchange.
Definition: wallet.h:70
void SerializationOp(Stream &s, Operation ser_action)
Definition: wallet.h:413
Definition: wallet.h:100
void SerializationOp(Stream &s, Operation ser_action)
Definition: wallet.h:616
void SetMerkleBranch(const CBlockIndex *pIndex, int posInBlock)
Definition: wallet.cpp:5492
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:80
int64_t IncOrderPosNext(WalletBatch *batch=nullptr)
Increment the next transaction order id.
Definition: wallet.cpp:997
bool LoadDestData(const CTxDestination &dest, const std::string &key, const std::string &value)
Adds a destination data tuple to the store, without saving it to disk.
Definition: wallet.cpp:4988
CAmount GetDenominatedCredit(bool unconfirmed, bool fUseCache=true) const
Definition: wallet.cpp:2360
const CWalletTx * GetWalletTx(const uint256 &hash) const
Definition: wallet.cpp:178
Definition: wallet.h:167
static bool Verify(std::string wallet_file, bool salvage_wallet, std::string &error_string, std::string &warning_string)
Verify wallet naming and perform salvage on the wallet if required.
Definition: wallet.cpp:5024
bool fSolvable
Whether we know how to spend this output, ignoring the lack of keys.
Definition: wallet.h:577
Definition: wallet.h:101
void GetKeyBirthTimes(std::map< CTxDestination, int64_t > &mapKeyBirth) const
Definition: wallet.cpp:4856
bool AccountMove(std::string strFrom, std::string strTo, CAmount nAmount, std::string strComment="")
Definition: wallet.cpp:1009
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
Definition: block.h:127
void TransactionAddedToMempool(const CTransactionRef &tx, int64_t nAcceptTime) override
Notifies listeners of a transaction having been added to mempool.
Definition: wallet.cpp:1431
void postInitProcess()
Wallet post-init setup Gives the wallet a chance to register repetitive tasks and complete post-init ...
Definition: wallet.cpp:5302
CAmount GetAvailableBalance(const CCoinControl *coinControl=nullptr) const
Definition: wallet.cpp:2760
const std::map< CKeyID, int64_t > & GetAllReserveKeys() const
Definition: wallet.h:1122
Definition: walletdb.h:59
char fFromMe
From me flag is set to 1 for transactions that were created by the wallet on this bitcoin node...
Definition: wallet.h:330
static const CAmount WALLET_INCREMENTAL_RELAY_FEE
minimum recommended increment for BIP 125 replacement txs
Definition: wallet.h:64
std::map< CTxDestination, CAddressBookData > mapAddressBook
Definition: wallet.h:906
std::vector< std::string > GetDestValues(const std::string &prefix) const
Get all destination values matching a prefix.
Definition: wallet.cpp:5010
static const CAmount MAX_MONEY
No amount larger than this (in satoshi) is valid.
Definition: amount.h:26
CAmount GetLegacyBalance(const isminefilter &filter, int minDepth, const std::string *account, const bool fAddLocked) const
Definition: wallet.cpp:2723
Definition: wallet.h:97
bool IsFromMe(const CTransaction &tx) const
should probably be renamed to IsRelevantToMe
Definition: wallet.cpp:1861
uint256 nPrivateSendSalt
Pulled from wallet DB ("ps_salt") and used when mixing a random number of rounds. ...
Definition: wallet.h:824
bool SelectDenominatedAmounts(CAmount nValueMax, std::set< CAmount > &setAmountsRet) const
Definition: wallet.cpp:3458
bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey) override
Adds a key to the store, and saves it to disk.
Definition: wallet.cpp:405
CAmount GetDebit(const isminefilter &filter) const
filter decides which addresses will count towards the debit
Definition: wallet.cpp:2169
Implementation of BIP69 https://github.com/bitcoin/bips/blob/master/bip-0069.mediawiki.
Definition: transaction.h:352
bool FundTransaction(CMutableTransaction &tx, CAmount &nFeeRet, int &nChangePosInOut, std::string &strFailReason, bool lockUnspents, const std::set< int > &setSubtractFeeFromOutputs, CCoinControl)
Insert additional inputs into the transaction by calling CreateTransaction();.
Definition: wallet.cpp:3252
const std::string & GetAccountName(const CScript &scriptPubKey) const
Definition: wallet.cpp:4315
Definition: wallet.h:104
std::multimap< COutPoint, uint256 > TxSpends
Used to keep track of spent outpoints, and detect and report conflicts (double-spends or mutated tran...
Definition: wallet.h:753
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
Definition: secure.h:57
bool fAnonymizableTallyCachedNonDenom
Definition: wallet.h:745
bool SelectPSInOutPairsByDenominations(int nDenom, CAmount nValueMax, std::vector< std::pair< CTxDSIn, CTxOut > > &vecPSInOutPairsRet)
Definition: wallet.cpp:3311
void AddToSpends(const COutPoint &outpoint, const uint256 &wtxid)
Definition: wallet.cpp:774
bool AutoBackupWallet(const fs::path &wallet_path, std::string &strBackupWarningRet, std::string &strBackupErrorRet)
Definition: wallet.cpp:5327
bool SetMaxVersion(int nVersion)
change which version we're allowed to upgrade to (note that this does not immediately imply upgrading...
Definition: wallet.cpp:673
Definition: box.hpp:161
bool SetMinVersion(enum WalletFeature, WalletBatch *batch_in=nullptr, bool fExplicit=false)
signify that a particular wallet feature is now used. this may change nWalletVersion and nWalletMaxVe...
Definition: wallet.cpp:647
void BlockDisconnected(const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindexDisconnected) override
Notifies listeners of a block being disconnected.
Definition: wallet.cpp:1502
static void ReadOrderPos(int64_t &nOrderPos, mapValue_t &mapValue)
Definition: wallet.h:177
Double ended buffer combining vector and stream-like interfaces.
Definition: streams.h:103
bool AddKeyPubKeyWithDB(WalletBatch &batch, const CKey &key, const CPubKey &pubkey)
Definition: wallet.cpp:369
CWalletKey(int64_t nExpires=0)
todo: add something to note what created it (user, getnewaddress, change) maybe should have a map<str...
Definition: wallet.cpp:5486
Definition: saltedhasher.h:64
static CWallet * CreateWalletFromFile(const std::string &name, const fs::path &path)
Definition: wallet.cpp:5075
void ReserveKeyFromKeyPool(int64_t &nIndex, CKeyPool &keypool, bool fInternal)
Definition: wallet.cpp:4458
CAmount GetUnconfirmedWatchOnlyBalance() const
Definition: wallet.cpp:2692
void LoadKeyPool(int64_t nIndex, const CKeyPool &keypool)
Definition: wallet.cpp:4366
bool LoadHDPubKey(const CHDPubKey &hdPubKey)
loads a HDPubKey into the wallets memory
Definition: wallet.cpp:336
bool EncryptWallet(const SecureString &strWalletPassphrase)
Definition: wallet.cpp:797
const CBlockIndex * m_last_block_processed
The following is used to keep track of how far behind the wallet is from the chain sync...
Definition: wallet.h:818
bool GetDestData(const CTxDestination &dest, const std::string &key, std::string *value) const
Look up a destination data tuple in the store, return true if found false otherwise.
Definition: wallet.cpp:4994
std::map< COutPoint, int > mapOutpointRoundsCache
Definition: wallet.h:759
std::set< uint256 > GetConflicts(const uint256 &txid) const
Get wallet transactions that conflict with given transaction (spend same outputs) ...
Definition: wallet.cpp:685
void BlockUntilSyncedToCurrentChain()
Blocks until the wallet state is up-to-date to /at least/ the current chain at the time this function...
Definition: wallet.cpp:1517
bool IsSpent(const uint256 &hash, unsigned int n) const
Outpoint is spent if any non-conflicted transaction spends it:
Definition: wallet.cpp:755
Definition: validationinterface.h:64
CAmount GetImmatureCredit(bool fUseCache=true) const
Definition: wallet.cpp:2233
bool SetHDChain(WalletBatch &batch, const CHDChain &chain, bool memonly)
Definition: wallet.cpp:1781
std::vector< CompactTallyItem > vecAnonymizableTallyCachedNonDenom
Definition: wallet.h:746
void SyncTransaction(const CTransactionRef &tx, const CBlockIndex *pindex=nullptr, int posInBlock=0)
Definition: wallet.cpp:1411
bool AddWatchOnly(const CScript &dest) override
Private version of AddWatchOnly method which does not accept a timestamp, and which will reset the wa...
Definition: wallet.cpp:490
bool LoadCryptedKey(const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret)
Adds an encrypted key to the store, without saving it to disk (used by LoadWallet) ...
Definition: wallet.cpp:446
std::map< CScriptID, CKeyMetadata > m_script_metadata
Definition: wallet.h:856
std::map< CTxDestination, CAmount > GetAddressBalances()
Definition: wallet.cpp:4574
bool operator()(const CInputCoin &a, const CInputCoin &b) const
Definition: wallet.h:558
CAmount GetImmatureWatchOnlyCredit(const bool fUseCache=true) const
Definition: wallet.cpp:2277
Definition: script.h:672
Definition: quorums_instantsend.h:20
bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey) override
Add a key to the store.
Definition: crypter.cpp:299
std::vector< unsigned char, secure_allocator< unsigned char > > CPrivKey
secure_allocator is defined in allocators.h CPrivKey is a serialized private key, with all parameters...
Definition: key.h:24
void MarkReserveKeysAsUsed(int64_t keypool_id)
Marks all keys in the keypool up to and including reserve_key as used.
Definition: wallet.cpp:4758
boost::signals2::signal< void(CWallet *wallet, const uint256 &hashTx, ChangeType status)> NotifyTransactionChanged
Wallet transaction added, removed or updated.
Definition: wallet.h:1197
static const bool DEFAULT_WALLET_REJECT_LONG_CHAINS
Default for -walletrejectlongchains.
Definition: wallet.h:72
void SetBroadcastTransactions(bool broadcast)
Set whether this wallet broadcasts transactions.
Definition: wallet.h:1214
bool SetAddressBook(const CTxDestination &address, const std::string &strName, const std::string &purpose)
Definition: wallet.cpp:4277
void MarkConflicted(const uint256 &hashBlock, const uint256 &hashTx)
Definition: wallet.cpp:1347
bool DelAddressBook(const CTxDestination &address)
Definition: wallet.cpp:4295
boost::signals2::signal< void(int height)> NotifyChainLockReceived
ChainLock received.
Definition: wallet.h:1209
CAmount GetAnonymizableBalance(bool fSkipDenominated=false, bool fSkipUnconfirmed=true) const
Definition: wallet.cpp:2555
unsigned int ComputeTimeSmart(const CWalletTx &wtx) const
Compute smart timestamp for a transaction being added to the wallet.
Definition: wallet.cpp:4928
bool AbandonTransaction(const uint256 &hashTx)
Definition: wallet.cpp:1283
bool LoadKeyMetadata(const CKeyID &keyID, const CKeyMetadata &metadata)
Load metadata (used by LoadWallet)
Definition: wallet.cpp:430
bool HasCollateralInputs(bool fOnlyConfirmed=true) const
Definition: wallet.cpp:3577
bool NewKeyPool()
Mark old keypool keys as used, and generate all new keys.
Definition: wallet.cpp:4334
bool SignTransaction(CMutableTransaction &tx)
bool AddCScript(const CScript &redeemScript) override
Support for BIP 0013 : see https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki.
Definition: wallet.cpp:467
We want to be able to estimate feerates that are needed on tx's to be included in a certain number of...
Definition: fees.h:138
void NotifyChainLock(const CBlockIndex *pindexChainLock, const llmq::CChainLockSig &clsig) override
Definition: wallet.cpp:5468
CReserveKey & operator=(const CReserveKey &)=delete
int GetVersion()
get the current wallet format (the oldest client version guaranteed to understand this wallet) ...
Definition: wallet.h:1175
bool GetKey(const CKeyID &address, CKey &keyOut) const override
GetKey implementation that can derive a HD private key on the fly.
Definition: wallet.cpp:300
static const CAmount MIN_FINAL_CHANGE
final minimum change amount after paying for fees
Definition: wallet.h:68
void ListProTxCoins(std::vector< COutPoint > &vOutpts)
Definition: wallet.cpp:4838
void SetBestChain(const CBlockLocator &loc) override
Notifies listeners of the new active block chain on-disk.
Definition: wallet.cpp:641
bool IsDenominated(const COutPoint &outpoint) const
Definition: wallet.cpp:1664
bool SelectCoins(const std::vector< COutput > &vAvailableCoins, const CAmount &nTargetValue, std::set< CInputCoin > &setCoinsRet, CAmount &nValueRet, const CCoinControl *coinControl=nullptr) const
Select a set of coins such that nValueRet >= nTargetValue and at least all coins from coinControl are...
Definition: wallet.cpp:3168
void SerializationOp(Stream &s, Operation ser_action)
Definition: wallet.h:246
bool SelectCoinsGroupedByAddresses(std::vector< CompactTallyItem > &vecTallyRet, bool fSkipDenominated=true, bool fAnonymizable=true, bool fSkipUnconfirmed=true, int nMaxOupointsPerAddress=-1) const
Definition: wallet.cpp:3355
bool TransactionCanBeAbandoned(const uint256 &hashTx) const
Return whether transaction can be abandoned.
Definition: wallet.cpp:1276
bool IsLockedCoin(uint256 hash, unsigned int n) const
Definition: wallet.cpp:4820
Definition: wallet.h:107
bool LoadKey(const CKey &key, const CPubKey &pubkey)
Adds a key to the store, without saving it to disk (used by LoadWallet)
Definition: wallet.h:1000
CAmount GetImmatureWatchOnlyBalance() const
Definition: wallet.cpp:2705
Definition: wallet.h:527
bool EraseDestData(const CTxDestination &dest, const std::string &key)
Erases a destination data tuple in the store and on disk.
Definition: wallet.cpp:4981
void UpdateTimeFirstKey(int64_t nCreateTime)
Update wallet first key creation time.
Definition: wallet.cpp:455
void InitPrivateSendSalt()
Fetches PrivateSend salt from database or generates and saves a new one if no salt was found in the d...
Definition: wallet.cpp:2934
CWallet(std::string name, std::unique_ptr< WalletDatabase > database)
Construct wallet with specified name and database implementation.
Definition: wallet.h:863
void ResendWalletTransactions(int64_t nBestBlockTime, CConnman *connman) override
Tells listeners to broadcast their data.
Definition: wallet.cpp:2486
static const bool DEFAULT_USE_HD_WALLET
if set, all keys will be derived by using BIP39/BIP44
Definition: wallet.h:81
DBErrors ZapSelectTx(std::vector< uint256 > &vHashIn, std::vector< uint256 > &vHashOut)
Definition: wallet.cpp:4220
bool AddToWalletIfInvolvingMe(const CTransactionRef &tx, const CBlockIndex *pIndex, int posInBlock, bool fUpdate)
Add a transaction to the wallet, or update it.
Definition: wallet.cpp:1217
Definition: fees.h:125
CAmount GetDenominatedBalance(bool unconfirmed=false) const
Definition: wallet.cpp:2638
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:26
void TransactionRemovedFromMempool(const CTransactionRef &ptx) override
Notifies listeners of a transaction leaving mempool.
Definition: wallet.cpp:1441
bool AddHDPubKey(WalletBatch &batch, const CExtPubKey &extPubKey, bool fInternal)
Adds a HDPubKey into the wallet(database)
Definition: wallet.cpp:344
bool IsAllFromMe(const CTransaction &tx, const isminefilter &filter) const
Returns whether all of the inputs match the filter.
Definition: wallet.cpp:1878
CAmount GetAnonymizedBalance(const CCoinControl *coinControl=nullptr) const
Definition: wallet.cpp:2577
bool Unlock(const SecureString &strWalletPassphrase, bool fForMixingOnly=false)
Definition: wallet.cpp:524
bool AddToWallet(const CWalletTx &wtxIn, bool fFlushOnClose=true)
Definition: wallet.cpp:1094
const CTxOut & FindNonChangeParentOutput(const CTransaction &tx, int output) const
Find non-change parent output.
Definition: wallet.cpp:2917
bool LoadScriptMetadata(const CScriptID &script_id, const CKeyMetadata &metadata)
Definition: wallet.cpp:438
int nWalletMaxVersion
the maximum wallet format version: memory-only variable that specifies to what version this wallet ma...
Definition: wallet.h:737
bool GetCollateralTxDSIn(CTxDSIn &txdsinRet, CAmount &nValueRet) const
Definition: wallet.cpp:3481
void AvailableCoins(std::vector< COutput > &vCoins, bool fOnlySafe=true, const CCoinControl *coinControl=nullptr, const CAmount &nMinimumAmount=1, const CAmount &nMaximumAmount=MAX_MONEY, const CAmount &nMinimumSumAmount=MAX_MONEY, const uint64_t nMaximumCount=0, const int nMinDepth=0, const int nMaxDepth=9999999) const
populate vCoins with vector of available COutputs.
Definition: wallet.cpp:2775
A transaction with a bunch of additional info that only the owner cares about.
Definition: wallet.h:280
bool AcceptToMemoryPool(const CAmount &nAbsurdFee, CValidationState &state)
Pass this transaction to the mempool.
Definition: wallet.cpp:5554
CAmount GetNormalizedAnonymizedBalance() const
Definition: wallet.cpp:2616
bool SetCryptedHDChain(WalletBatch &batch, const CHDChain &chain, bool memonly)
Definition: wallet.cpp:1794
bool GetBroadcastTransactions() const
Inquire whether this wallet broadcasts transactions.
Definition: wallet.h:1212
CBlockIndex * ScanForWalletTransactions(CBlockIndex *pindexStart, CBlockIndex *pindexStop, const WalletRescanReserver &reserver, bool fUpdate=false)
Scan the block chain (starting in pindexStart) for transactions from or to us.
Definition: wallet.cpp:2030
int GetCappedOutpointPrivateSendRounds(const COutPoint &outpoint) const
Definition: wallet.cpp:1657
static void WriteOrderPos(const int64_t &nOrderPos, mapValue_t &mapValue)
Definition: wallet.h:188
CAmount GetAvailableCredit(bool fUseCache=true) const
Definition: wallet.cpp:2247
std::vector< uint256 > ResendWalletTransactionsBefore(int64_t nTime, CConnman *connman)
Definition: wallet.cpp:2461
std::set< CTxDestination > GetAccountAddresses(const std::string &strAccount) const
Definition: wallet.cpp:4707
bool GetOutpointAndKeysFromOutput(const COutput &out, COutPoint &outpointRet, CPubKey &pubKeyRet, CKey &keyRet)
Extract txin information and keys from output.
Definition: wallet.cpp:3531
CWalletTx(const CWallet *pwalletIn, CTransactionRef arg)
Definition: wallet.h:367
void GetScriptForMining(std::shared_ptr< CReserveScript > &script)
Definition: wallet.cpp:4781
Definition: hdchain.h:28
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Definition: txmempool.h:442
std::map< CTxDestination, std::vector< COutput > > ListCoins() const
Return list of available coins and locked coins grouped by non-change output address.
Definition: wallet.cpp:2871
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.
Definition: wallet.h:1190
static CFeeRate fallbackFee
If fee estimation does not have enough data to provide estimates, use this fee instead.
Definition: wallet.h:1106
CAmount GetDebit(const CTxIn &txin, const isminefilter &filter) const
Returns amount of debit if the input matches the filter, otherwise returns 0.
Definition: wallet.cpp:1559
bool SetCryptedHDChainSingle(const CHDChain &chain, bool memonly)
Definition: wallet.cpp:1820
bool ChangeWalletPassphrase(const SecureString &strOldWalletPassphrase, const SecureString &strNewWalletPassphrase)
Definition: wallet.cpp:567
const std::string & GetName() const
Get a name for this wallet for logging/debugging purposes.
Definition: wallet.h:848
void NotifyTransactionLock(const CTransaction &tx, const llmq::CInstantSendLock &islock) override
Definition: wallet.cpp:5450
void SyncMetaData(std::pair< TxSpends::iterator, TxSpends::iterator >)
Definition: wallet.cpp:713
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: chain.h:170
Definition: wallet.h:518
bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector< unsigned char > &vchCryptedSecret) override
Adds an encrypted key to the store, and saves it to disk.
Definition: wallet.cpp:412
unsigned int nTimeSmart
Stable timestamp that never changes, and reflects the order a transaction was added to the wallet...
Definition: wallet.h:324
void BlockConnected(const std::shared_ptr< const CBlock > &pblock, const CBlockIndex *pindex, const std::vector< CTransactionRef > &vtxConflicted) override
Notifies listeners of a block being connected.
Definition: wallet.cpp:1449
void ListAccountCreditDebit(const std::string &strAccount, std::list< CAccountingEntry > &entries)
Definition: wallet.cpp:4135
Definition: wallet.h:566
bool SetHDChainSingle(const CHDChain &chain, bool memonly)
Set the HD chain model (chain child index counters) using temporary wallet db object which causes db ...
Definition: wallet.cpp:1814
bool RelayWalletTransaction(CConnman *connman)
Definition: wallet.cpp:2137
void SerializationOp(Stream &s, Operation ser_action)
Definition: wallet.h:1326
Definition: wallet.h:99
Private key that includes an expiration date in case it never gets used.
Definition: wallet.h:601
bool CreateTransaction(const std::vector< CRecipient > &vecSend, CWalletTx &wtxNew, CReserveKey &reservekey, CAmount &nFeeRet, int &nChangePosInOut, std::string &strFailReason, const CCoinControl &coin_control, bool sign=true, int nExtraPayloadSize=0)
Create a new transaction paying the recipients with a set of coins selected by SelectCoins(); Also cr...
Definition: wallet.cpp:3658
static CFeeRate minTxFee
Fees smaller than this (in duffs) are considered zero fee (for transaction creation) Override with -m...
Definition: wallet.h:1105
int nWalletVersion
the current wallet version: clients below this version are not able to load the wallet ...
Definition: wallet.h:734
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
Definition: wallet.h:715
CPubKey GenerateNewKey(WalletBatch &batch, uint32_t nAccountIndex, bool fInternal)
keystore implementation Generate a new key
Definition: wallet.cpp:187
COutput(const CWalletTx *txIn, int iIn, int nDepthIn, bool fSpendableIn, bool fSolvableIn, bool fSafeIn)
Definition: wallet.h:586
int GetRealOutpointPrivateSendRounds(const COutPoint &outpoint, int nRounds=0) const
Definition: wallet.cpp:1576
Definition: wallet.h:195
std::vector< CompactTallyItem > vecAnonymizableTallyCached
Definition: wallet.h:744
boost::signals2::signal< void(const std::string &title, int nProgress)> ShowProgress
Show progress e.g.
Definition: wallet.h:1200
A reference to a CScript: the Hash160 of its serialization (see script.h)
Definition: standard.h:22
bool CreateCollateralTransaction(CMutableTransaction &txCollateral, std::string &strReason)
Definition: wallet.cpp:3587
CAmount GetAnonymizedCredit(const CCoinControl *coinControl=nullptr) const
Definition: wallet.cpp:2320
void SerializationOp(Stream &s, Operation ser_action)
Definition: wallet.h:132
CAmount GetAvailableWatchOnlyCredit(const bool fUseCache=true) const
Definition: wallet.cpp:2291
bool GetReservedKey(CPubKey &pubkey, bool fInternalIn)
Definition: wallet.cpp:4721
std::multimap< int64_t, std::pair< CWalletTx *, CAccountingEntry * > >::const_iterator m_it_wtxOrdered
Definition: wallet.h:333
std::string m_name
Wallet filename from wallet=<path> command line or config option.
Definition: wallet.h:796
Definition: quorums_chainlocks.h:25
Definition: pubkey.h:200
The basic transaction that is broadcasted on the network and contained in blocks. ...
Definition: transaction.h:198
bool GetMasternodeOutpointAndKeys(COutPoint &outpointRet, CPubKey &pubKeyRet, CKey &keyRet, const std::string &strTxHash="", const std::string &strOutputIndex="")
Get 1000DASH output and keys which can be used for the Masternode.
Definition: wallet.cpp:3501
bool AddDestData(const CTxDestination &dest, const std::string &key, const std::string &value)
Adds a destination data tuple to the store, and saves it to disk.
Definition: wallet.cpp:4972
void ListLockedCoins(std::vector< COutPoint > &vOutpts) const
Definition: wallet.cpp:4828
Definition: hdchain.h:122
bool GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const override
GetPubKey implementation that also checks the mapHdPubKeys.
Definition: wallet.cpp:286
Definition: wallet.h:556
CAmount GetCredit(const CTxOut &txout, const isminefilter &filter) const
Definition: wallet.cpp:1708
int64_t RescanFromTime(int64_t startTime, const WalletRescanReserver &reserver, bool update)
Scan active chain for relevant transactions after importing keys.
Definition: wallet.cpp:1993
AssertLockHeld(g_cs_orphans)
bool AddAccountingEntry(const CAccountingEntry &)
Definition: wallet.cpp:4140
boost::signals2::signal< void(bool fHaveWatchOnly)> NotifyWatchonlyChanged
Watch-only address added.
Definition: wallet.h:1203
float GetAverageAnonymizedRounds() const
Definition: wallet.cpp:2594
bool GetDecryptedHDChain(CHDChain &hdChainRet)
Definition: wallet.cpp:1826
void ReturnKey(int64_t nIndex, bool fInternal, const CPubKey &pubkey)
Definition: wallet.cpp:4506
void AutoLockMasternodeCollaterals()
Definition: wallet.cpp:4204
int64_t nRelockTime
Holds a timestamp at which point the wallet is scheduled (externally) to be relocked. Caller must arrange for actual relocking to occur via Lock().
Definition: wallet.h:1034
bool HaveKey(const CKeyID &address) const override
HaveKey implementation that also checks the mapHdPubKeys.
Definition: wallet.cpp:328
bool LoadWatchOnly(const CScript &dest)
Adds a watch-only address to the store, without saving it to disk (used by LoadWallet) ...
Definition: wallet.cpp:519
void DeriveNewChildKey(WalletBatch &batch, const CKeyMetadata &metadata, CKey &secretRet, uint32_t nAccountIndex, bool fInternal)
Definition: wallet.cpp:225
Definition: serialize.h:162
Wrapped mutex: supports recursive locking, but no waiting TODO: We should move away from using the re...
Definition: sync.h:94
bool RemoveWatchOnly(const CScript &dest) override
Definition: wallet.cpp:506
int CountInputsWithAmount(CAmount nInputAmount) const
Definition: wallet.cpp:3559
bool GetBudgetSystemCollateralTX(CWalletTx &tx, uint256 hash, CAmount amount, const COutPoint &outpoint=COutPoint())
Definition: wallet.cpp:3631
std::vector< std::pair< std::string, std::string > > vOrderForm
Definition: wallet.h:312
CReserveKey()=default
bool CommitTransaction(CWalletTx &wtxNew, CReserveKey &reservekey, CConnman *connman, CValidationState &state)
Call after CreateTransaction unless you want to abort.
Definition: wallet.cpp:4089
void GetAmounts(std::list< COutputEntry > &listReceived, std::list< COutputEntry > &listSent, CAmount &nFee, std::string &strSentAccount, const isminefilter &filter) const
Definition: wallet.cpp:1929