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
walletmodel.cpp
Go to the documentation of this file.
162 if(fForceCheckBalanceChanged || chainActive.Height() != cachedNumBlocks || privateSendClient.nPrivateSendRounds != cachedPrivateSendRounds)
192 if(cachedBalance != newBalance || cachedUnconfirmedBalance != newUnconfirmedBalance || cachedImmatureBalance != newImmatureBalance ||
194 cachedWatchOnlyBalance != newWatchOnlyBalance || cachedWatchUnconfBalance != newWatchUnconfBalance || cachedWatchImmatureBalance != newWatchImmatureBalance)
203 Q_EMIT balanceChanged(newBalance, newUnconfirmedBalance, newImmatureBalance, newAnonymizedBalance,
223 // Number and status of confirmations might have changed (WalletModel::pollBalanceChanged handles this as well)
260 WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransaction &transaction, const CCoinControl& coinControl)
355 fCreated = wallet->CreateTransaction(vecSend, *newTx, *keyChange, nFeeRequired, nChangePosRet, strFailReason, coinControl);
419 return SendCoinsReturn(TransactionCommitFailed, QString::fromStdString(state.GetRejectReason()));
454 checkBalanceChanged(); // update balance immediately, otherwise there could be a short noticeable delay until pollBalanceChanged hits
573 qDebug() << "NotifyAddressBookChanged: " + strAddress + " " + strLabel + " isMine=" + QString::number(isMine) + " purpose=" + strPurpose + " status=" + QString::number(status);
582 static void NotifyTransactionChanged(WalletModel *walletmodel, CWallet *wallet, const uint256 &hash, ChangeType status)
619 wallet->NotifyAddressBookChanged.connect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5, _6));
620 wallet->NotifyTransactionChanged.connect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3));
631 wallet->NotifyAddressBookChanged.disconnect(boost::bind(NotifyAddressBookChanged, this, _1, _2, _3, _4, _5, _6));
632 wallet->NotifyTransactionChanged.disconnect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3));
664 // Wallet was not locked in any way or user tried to unlock it for mixing only and succeeded, keep it unlocked
670 WalletModel::UnlockContext::UnlockContext(WalletModel *_wallet, bool _valid, bool _was_locked, bool _was_mixing):
715 void WalletModel::getOutputs(const std::vector<COutPoint>& vOutpoints, std::vector<COutput>& vOutputs)
724 COutput out(&it->second, outpoint.n, nDepth, true /* spendable */, true /* solvable */, true /* safe */);
735 // AvailableCoins + LockedCoins grouped by wallet address (put change in one group with wallet address)
781 bool WalletModel::saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest)
Definition: walletmodel.h:153
bool abandonTransaction(uint256 hash) const
Definition: walletmodel.cpp:801
void loadReceiveRequests(std::vector< std::string > &vReceiveRequests)
Definition: walletmodel.cpp:776
bool isLockedCoin(uint256 hash, unsigned int n) const
Definition: walletmodel.cpp:746
void listCoins(std::map< QString, std::vector< COutput > > &mapCoins) const
Definition: walletmodel.cpp:736
CTxMemPool mempool
Model for list of recently generated payment requests / dash: URIs.
Definition: recentrequeststablemodel.h:58
TransactionTableModel * transactionTableModel
Definition: walletmodel.h:245
void getOutputs(const std::vector< COutPoint > &vOutpoints, std::vector< COutput > &vOutputs)
Definition: walletmodel.cpp:715
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:80
RecentRequestsTableModel * recentRequestsTableModel
Definition: walletmodel.h:246
Definition: wallet.h:167
UnlockContext(WalletModel *wallet, bool valid, bool was_locked, bool was_mixing)
Definition: walletmodel.cpp:670
CWalletTx * getTransaction() const
Definition: walletmodeltransaction.cpp:27
CAmount GetAvailableBalance(const CCoinControl *coinControl=nullptr) const
Definition: wallet.cpp:2760
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
CAmount maxTxFee
Absolute maximum transaction fee (in duffs) used by wallet and mempool (rejects high fee in sendrawtr...
Definition: validation.cpp:247
void requireUnlock(bool fForMixingOnly=false)
void unsubscribeFromCoreSignals()
Definition: walletmodel.cpp:627
void updateChainLockHeight(int chainLockHeight)
Definition: walletmodel.cpp:219
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
Definition: secure.h:57
bool AutoBackupWallet(const fs::path &wallet_path, std::string &strBackupWarningRet, std::string &strBackupErrorRet)
Definition: wallet.cpp:5327
SendCoinsReturn sendCoins(WalletModelTransaction &transaction)
Definition: walletmodel.cpp:384
bool transactionCanBeAbandoned(uint256 hash) const
Definition: walletmodel.cpp:796
QList< SendCoinsRecipient > getRecipients() const
Definition: walletmodeltransaction.cpp:22
Double ended buffer combining vector and stream-like interfaces.
Definition: streams.h:103
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
Definition: util.cpp:824
CAmount GetUnconfirmedWatchOnlyBalance() const
Definition: wallet.cpp:2692
AddressTableModel * getAddressTableModel()
Definition: walletmodel.cpp:464
CAmount getDenominatedBalance(bool unconfirmed) const
Definition: walletmodel.cpp:97
bool EncryptWallet(const SecureString &strWalletPassphrase)
Definition: wallet.cpp:797
bool IsSpent(const uint256 &hash, unsigned int n) const
Outpoint is spent if any non-conflicted transaction spends it:
Definition: wallet.cpp:755
Definition: walletmodel.h:110
void newPossibleKeyChange(CWallet *wallet)
Definition: walletmodeltransaction.cpp:96
EncryptionStatus getEncryptionStatus() const
Definition: walletmodel.cpp:479
CAmount getBalance(const CCoinControl *coinControl=nullptr) const
Definition: walletmodel.cpp:76
void setTransactionFee(const CAmount &newFee)
Definition: walletmodeltransaction.cpp:42
boost::signals2::signal< void(CWallet *wallet, const uint256 &hashTx, ChangeType status)> NotifyTransactionChanged
Wallet transaction added, removed or updated.
Definition: wallet.h:1197
bool SetAddressBook(const CTxDestination &address, const std::string &strName, const std::string &purpose)
Definition: wallet.cpp:4277
Definition: walletmodel.h:112
WalletModel(CWallet *wallet, OptionsModel *optionsModel, QObject *parent=0)
Definition: walletmodel.cpp:40
boost::signals2::signal< void(CCryptoKeyStore *wallet)> NotifyStatusChanged
Wallet status (encrypted, locked) changed.
Definition: crypter.h:172
bool getPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const
Definition: walletmodel.cpp:694
void updateChainLockHeight(int chainLockHeight)
Definition: transactiontablemodel.cpp:304
bool IsValidDestinationString(const std::string &str, const CChainParams ¶ms)
Definition: base58.cpp:341
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
int64_t getKeysLeftSinceAutoBackup() const
Definition: walletmodel.cpp:553
bool AbandonTransaction(const uint256 &hashTx)
Definition: wallet.cpp:1283
Definition: walletmodel.h:111
bool getPrivKey(const CKeyID &address, CKey &vchPrivKeyOut) const
Definition: walletmodel.cpp:709
bool changePassphrase(const SecureString &oldPass, const SecureString &newPass)
Definition: walletmodel.cpp:527
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
void listProTxCoins(std::vector< COutPoint > &vOutpts)
Definition: walletmodel.cpp:770
void ListProTxCoins(std::vector< COutPoint > &vOutpts)
Definition: wallet.cpp:4838
int getDefaultConfirmTarget() const
Definition: walletmodel.cpp:817
CAmount getWatchUnconfirmedBalance() const
Definition: walletmodel.cpp:132
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: walletmodel.h:39
SendCoinsReturn prepareTransaction(WalletModelTransaction &transaction, const CCoinControl &coinControl)
Definition: walletmodel.cpp:260
CAmount GetImmatureWatchOnlyBalance() const
Definition: wallet.cpp:2705
static bool verifyExpired(const payments::PaymentDetails &requestDetails)
Definition: paymentserver.cpp:773
bool EraseDestData(const CTxDestination &dest, const std::string &key)
Erases a destination data tuple in the store and on disk.
Definition: wallet.cpp:4981
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
Definition: standard.cpp:256
CAmount getAnonymizedBalance(const CCoinControl *coinControl=nullptr) const
Definition: walletmodel.cpp:92
TransactionTableModel * getTransactionTableModel()
Definition: walletmodel.cpp:469
CAmount GetDenominatedBalance(bool unconfirmed=false) const
Definition: wallet.cpp:2638
Definition: ui_interface.h:72
EncryptionStatus cachedEncryptionStatus
Definition: walletmodel.h:256
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:26
void CopyFrom(const UnlockContext &rhs)
Definition: walletmodel.cpp:686
UI model for the transaction table of a wallet.
Definition: transactiontablemodel.h:21
CAmount GetAnonymizedBalance(const CCoinControl *coinControl=nullptr) const
Definition: wallet.cpp:2577
bool Unlock(const SecureString &strWalletPassphrase, bool fForMixingOnly=false)
Definition: wallet.cpp:524
A transaction with a bunch of additional info that only the owner cares about.
Definition: wallet.h:280
CAmount GetNormalizedAnonymizedBalance() const
Definition: wallet.cpp:2616
void encryptionStatusChanged(int status)
static void NotifyAddressBookChanged(WalletModel *walletmodel, CWallet *wallet, const CTxDestination &address, const std::string &label, bool isMine, const std::string &purpose, ChangeType status)
Definition: walletmodel.cpp:565
bool validateAddress(const QString &address)
Definition: walletmodel.cpp:255
void updateWatchOnlyFlag(bool fHaveWatchonly)
Definition: walletmodel.cpp:249
CReserveKey * getPossibleKeyChange()
Definition: walletmodeltransaction.cpp:101
static void NotifyTransactionChanged(WalletModel *walletmodel, CWallet *wallet, const uint256 &hash, ChangeType status)
Definition: walletmodel.cpp:582
CAmount getAverageAnonymizedRounds() const
Definition: walletmodel.cpp:107
CAmount cachedWatchImmatureBalance
Definition: walletmodel.h:255
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
std::string EncodeDestination(const CTxDestination &dest)
Definition: base58.cpp:329
RecentRequestsTableModel * getRecentRequestsTableModel()
Definition: walletmodel.cpp:474
UnlockContext requestUnlock(bool fForMixingOnly=false)
Definition: walletmodel.cpp:640
Definition: ismine.h:25
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
bool ChangeWalletPassphrase(const SecureString &strOldWalletPassphrase, const SecureString &strNewWalletPassphrase)
Definition: wallet.cpp:567
bool autoBackupWallet(QString &strBackupWarningRet, QString &strBackupErrorRet)
Definition: walletmodel.cpp:543
void listLockedCoins(std::vector< COutPoint > &vOutpts)
Definition: walletmodel.cpp:764
Interface from Qt to configuration data structure for Bitcoin client.
Definition: optionsmodel.h:25
int nPrivateSendRounds
Definition: privatesend-client.h:208
static void NotifyISLockReceived(WalletModel *walletmodel)
Definition: walletmodel.cpp:590
CAmount getNormalizedAnonymizedBalance() const
Definition: walletmodel.cpp:102
CAmount getUnconfirmedBalance() const
Definition: walletmodel.cpp:112
Definition: wallet.h:566
bool setWalletEncrypted(bool encrypted, const SecureString &passphrase)
Definition: walletmodel.cpp:499
int getRealOutpointPrivateSendRounds(const COutPoint &outpoint) const
Definition: walletmodel.cpp:232
Definition: walletmodel.h:124
void message(const QString &title, const QString &message, unsigned int style)
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
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
Definition: wallet.h:715
void balanceChanged(const CAmount &balance, const CAmount &unconfirmedBalance, const CAmount &immatureBalance, const CAmount &anonymizedBalance, const CAmount &watchOnlyBalance, const CAmount &watchUnconfBalance, const CAmount &watchImmatureBalance)
void notifyWatchonlyChanged(bool fHaveWatchonly)
Data model for a walletmodel transaction.
Definition: walletmodeltransaction.h:21
void coinsSent(CWallet *wallet, SendCoinsRecipient recipient, QByteArray transaction)
static void NotifyKeyStoreStatusChanged(WalletModel *walletmodel, CCryptoKeyStore *wallet)
Definition: walletmodel.cpp:559
int GetRealOutpointPrivateSendRounds(const COutPoint &outpoint, int nRounds=0) const
Definition: wallet.cpp:1576
boost::signals2::signal< void(const std::string &title, int nProgress)> ShowProgress
Show progress e.g.
Definition: wallet.h:1200
static void NotifyChainLockReceived(WalletModel *walletmodel, int chainLockHeight)
Definition: walletmodel.cpp:595
Definition: walletmodel.h:182
static void NotifyWatchonlyChanged(WalletModel *walletmodel, bool fHaveWatchonly)
Definition: walletmodel.cpp:609
Definition: walletmodel.h:127
CAmount getWatchImmatureBalance() const
Definition: walletmodel.cpp:137
bool HaveWatchOnly(const CScript &dest) const override
Definition: keystore.cpp:138
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
bool GetPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const override
GetPubKey implementation that also checks the mapHdPubKeys.
Definition: wallet.cpp:286
CChain & chainActive
The currently-connected chain of blocks (protected by cs_main).
Definition: validation.cpp:217
static void ShowProgress(WalletModel *walletmodel, const std::string &title, int nProgress)
Definition: walletmodel.cpp:601
void updateConfirmations()
Definition: transactiontablemodel.cpp:294
bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest)
Definition: walletmodel.cpp:781
boost::signals2::signal< void(bool fHaveWatchOnly)> NotifyWatchonlyChanged
Watch-only address added.
Definition: wallet.h:1203
float GetAverageAnonymizedRounds() const
Definition: wallet.cpp:2594
Definition: serialize.h:160
Definition: walletmodel.h:115
void updateAddressBook(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
Definition: walletmodel.cpp:242
Definition: walletmodel.h:125
Definition: walletmodel.h:118
CAmount getAnonymizableBalance(bool fSkipDenominated, bool fSkipUnconfirmed) const
Definition: walletmodel.cpp:87
isminetype IsMine(const CKeyStore &keystore, const CTxDestination &dest)
Definition: ismine.cpp:28
void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
Definition: addresstablemodel.cpp:338
bool isFullyMixed(const COutPoint &outpoint) const
Definition: walletmodel.cpp:237
bool setWalletLocked(bool locked, const SecureString &passPhrase=SecureString(), bool fMixing=false)
Definition: walletmodel.cpp:513
void reassignAmounts()
Definition: walletmodeltransaction.cpp:47
bool IsSpendable(const CTxDestination &dest) const
Definition: walletmodel.cpp:699
std::vector< std::pair< std::string, std::string > > vOrderForm
Definition: wallet.h:312
bool CommitTransaction(CWalletTx &wtxNew, CReserveKey &reservekey, CConnman *connman, CValidationState &state)
Call after CreateTransaction unless you want to abort.
Definition: wallet.cpp:4089