Bitcoin ABC  0.24.7
P2P Digital Currency
walletmodel.cpp
Go to the documentation of this file.
1 // Copyright (c) 2011-2019 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include <qt/walletmodel.h>
6 
7 #include <cashaddrenc.h>
8 #include <interfaces/handler.h>
9 #include <interfaces/node.h>
10 #include <key_io.h>
11 #include <node/ui_interface.h>
12 #include <psbt.h>
13 #include <qt/addresstablemodel.h>
14 #include <qt/clientmodel.h>
15 #include <qt/guiconstants.h>
16 #include <qt/paymentserver.h>
19 #include <util/system.h> // for GetBoolArg
20 #include <util/translation.h>
21 #include <wallet/coincontrol.h>
22 #include <wallet/wallet.h> // for CRecipient
23 
24 #include <QDebug>
25 #include <QSet>
26 #include <QTimer>
27 
28 #include <cstdint>
29 
30 WalletModel::WalletModel(std::unique_ptr<interfaces::Wallet> wallet,
31  ClientModel &client_model,
32  const PlatformStyle *platformStyle, QObject *parent)
33  : QObject(parent), m_wallet(std::move(wallet)),
34  m_client_model(&client_model), m_node(client_model.node()),
35  optionsModel(client_model.getOptionsModel()), addressTableModel(nullptr),
36  transactionTableModel(nullptr), recentRequestsTableModel(nullptr),
37  cachedEncryptionStatus(Unencrypted), timer(new QTimer(this)) {
38  fHaveWatchOnly = m_wallet->haveWatchOnly();
40  transactionTableModel = new TransactionTableModel(platformStyle, this);
42 
44 }
45 
48 }
49 
51  // This timer will be fired repeatedly to update the balance
52  connect(timer, &QTimer::timeout, this, &WalletModel::pollBalanceChanged);
53  timer->start(MODEL_UPDATE_DELAY);
54 }
55 
57  m_client_model = client_model;
58  if (!m_client_model) {
59  timer->stop();
60  }
61 }
62 
64  EncryptionStatus newEncryptionStatus = getEncryptionStatus();
65 
66  if (cachedEncryptionStatus != newEncryptionStatus) {
67  Q_EMIT encryptionStatusChanged();
68  }
69 }
70 
72  // Avoid recomputing wallet balances unless a TransactionChanged or
73  // BlockTip notification was received.
76  return;
77  }
78 
79  // Try to get balances and return early if locks can't be acquired. This
80  // avoids the GUI from getting stuck on periodical polls if the core is
81  // holding the locks for a longer time - for example, during a wallet
82  // rescan.
83  interfaces::WalletBalances new_balances;
84  BlockHash block_hash;
85  if (!m_wallet->tryGetBalances(new_balances, block_hash)) {
86  return;
87  }
88 
91 
92  // Balance and number of transactions might have changed
93  m_cached_last_update_tip = block_hash;
94 
95  checkBalanceChanged(new_balances);
98  }
99  }
100 }
101 
103  const interfaces::WalletBalances &new_balances) {
104  if (new_balances.balanceChanged(m_cached_balances)) {
105  m_cached_balances = new_balances;
106  Q_EMIT balanceChanged(new_balances);
107  }
108 }
109 
111  // Balance and number of transactions might have changed
113 }
114 
115 void WalletModel::updateAddressBook(const QString &address,
116  const QString &label, bool isMine,
117  const QString &purpose, int status) {
118  if (addressTableModel) {
119  addressTableModel->updateEntry(address, label, isMine, purpose, status);
120  }
121 }
122 
123 void WalletModel::updateWatchOnlyFlag(bool fHaveWatchonly) {
124  fHaveWatchOnly = fHaveWatchonly;
125  Q_EMIT notifyWatchonlyChanged(fHaveWatchonly);
126 }
127 
128 bool WalletModel::validateAddress(const QString &address) {
129  return IsValidDestinationString(address.toStdString(), getChainParams());
130 }
131 
134  const CCoinControl &coinControl) {
135  Amount total = Amount::zero();
136  bool fSubtractFeeFromAmount = false;
137  QList<SendCoinsRecipient> recipients = transaction.getRecipients();
138  std::vector<CRecipient> vecSend;
139 
140  if (recipients.empty()) {
141  return OK;
142  }
143 
144  // Used to detect duplicates
145  QSet<QString> setAddress;
146  int nAddresses = 0;
147 
148  // Pre-check input data for validity
149  for (const SendCoinsRecipient &rcp : recipients) {
150  if (rcp.fSubtractFeeFromAmount) {
151  fSubtractFeeFromAmount = true;
152  }
153 
154 #ifdef ENABLE_BIP70
155  // PaymentRequest...
156  if (rcp.paymentRequest.IsInitialized()) {
157  Amount subtotal = Amount::zero();
158  const payments::PaymentDetails &details =
159  rcp.paymentRequest.getDetails();
160  for (int i = 0; i < details.outputs_size(); i++) {
161  const payments::Output &out = details.outputs(i);
162  if (out.amount() <= 0) {
163  continue;
164  }
165 
166  subtotal += int64_t(out.amount()) * SATOSHI;
167  const uint8_t *scriptStr = (const uint8_t *)out.script().data();
168  CScript scriptPubKey(scriptStr,
169  scriptStr + out.script().size());
170  Amount nAmount = int64_t(out.amount()) * SATOSHI;
171  CRecipient recipient = {scriptPubKey, nAmount,
172  rcp.fSubtractFeeFromAmount};
173  vecSend.push_back(recipient);
174  }
175 
176  if (subtotal <= Amount::zero()) {
177  return InvalidAmount;
178  }
179  total += subtotal;
180  }
181 
182  // User-entered bitcoin address / amount:
183  else
184 #endif
185  {
186  if (!validateAddress(rcp.address)) {
187  return InvalidAddress;
188  }
189  if (rcp.amount <= Amount::zero()) {
190  return InvalidAmount;
191  }
192  setAddress.insert(rcp.address);
193  ++nAddresses;
194 
195  CScript scriptPubKey = GetScriptForDestination(
196  DecodeDestination(rcp.address.toStdString(), getChainParams()));
197  CRecipient recipient = {scriptPubKey, Amount(rcp.amount),
198  rcp.fSubtractFeeFromAmount};
199  vecSend.push_back(recipient);
200 
201  total += rcp.amount;
202  }
203  }
204  if (setAddress.size() != nAddresses) {
205  return DuplicateAddress;
206  }
207 
208  Amount nBalance = m_wallet->getAvailableBalance(coinControl);
209 
210  if (total > nBalance) {
211  return AmountExceedsBalance;
212  }
213 
214  Amount nFeeRequired = Amount::zero();
215  int nChangePosRet = -1;
217 
218  auto &newTx = transaction.getWtx();
219  newTx = m_wallet->createTransaction(
220  vecSend, coinControl, !wallet().privateKeysDisabled() /* sign */,
221  nChangePosRet, nFeeRequired, error);
222  transaction.setTransactionFee(nFeeRequired);
223  if (fSubtractFeeFromAmount && newTx) {
224  transaction.reassignAmounts(nChangePosRet);
225  }
226 
227  if (!newTx) {
228  if (!fSubtractFeeFromAmount && (total + nFeeRequired) > nBalance) {
230  }
231  Q_EMIT message(tr("Send Coins"),
232  QString::fromStdString(error.translated),
235  }
236 
237  // Reject absurdly high fee. (This can never happen because the
238  // wallet never creates transactions with fee greater than
239  // m_default_max_tx_fee. This merely a belt-and-suspenders check).
240  if (nFeeRequired > m_wallet->getDefaultMaxTxFee()) {
241  return AbsurdFee;
242  }
243 
244  return SendCoinsReturn(OK);
245 }
246 
249  /* store serialized transaction */
250  QByteArray transaction_array;
251 
252  std::vector<std::pair<std::string, std::string>> vOrderForm;
253  for (const SendCoinsRecipient &rcp : transaction.getRecipients()) {
254 #ifdef ENABLE_BIP70
255  if (rcp.paymentRequest.IsInitialized()) {
256  // Make sure any payment requests involved are still valid.
257  if (PaymentServer::verifyExpired(rcp.paymentRequest.getDetails())) {
258  return PaymentRequestExpired;
259  }
260 
261  // Store PaymentRequests in wtx.vOrderForm in wallet.
262  std::string value;
263  rcp.paymentRequest.SerializeToString(&value);
264  vOrderForm.emplace_back("PaymentRequest", std::move(value));
265  } else
266 #endif
267  {
268  if (!rcp.message.isEmpty()) {
269  // Message from normal bitcoincash:URI
270  // (bitcoincash:123...?message=example)
271  vOrderForm.emplace_back("Message", rcp.message.toStdString());
272  }
273  }
274  }
275 
276  auto &newTx = transaction.getWtx();
277  wallet().commitTransaction(newTx, {} /* mapValue */, std::move(vOrderForm));
278 
280  ssTx << *newTx;
281  transaction_array.append(&(ssTx[0]), ssTx.size());
282 
283  // Add addresses / update labels that we've sent to the address book, and
284  // emit coinsSent signal for each recipient
285  for (const SendCoinsRecipient &rcp : transaction.getRecipients()) {
286  // Don't touch the address book when we have a payment request
287 #ifdef ENABLE_BIP70
288  if (!rcp.paymentRequest.IsInitialized())
289 #endif
290  {
291  std::string strAddress = rcp.address.toStdString();
292  CTxDestination dest =
293  DecodeDestination(strAddress, getChainParams());
294  std::string strLabel = rcp.label.toStdString();
295  // Check if we have a new address or an updated label
296  std::string name;
297  if (!m_wallet->getAddress(dest, &name, /* is_mine= */ nullptr,
298  /* purpose= */ nullptr)) {
299  m_wallet->setAddressBook(dest, strLabel, "send");
300  } else if (name != strLabel) {
301  // "" means don't change purpose
302  m_wallet->setAddressBook(dest, strLabel, "");
303  }
304  }
305  Q_EMIT coinsSent(this->wallet(), rcp, transaction_array);
306  }
307 
308  // update balance immediately, otherwise there could be a short noticeable
309  // delay until pollBalanceChanged hits
310  checkBalanceChanged(m_wallet->getBalances());
311 
312  return SendCoinsReturn(OK);
313 }
314 
316  return optionsModel;
317 }
318 
320  return addressTableModel;
321 }
322 
324  return transactionTableModel;
325 }
326 
329 }
330 
332  if (!m_wallet->isCrypted()) {
333  return Unencrypted;
334  } else if (m_wallet->isLocked()) {
335  return Locked;
336  } else {
337  return Unlocked;
338  }
339 }
340 
342  const SecureString &passphrase) {
343  if (encrypted) {
344  return m_wallet->encryptWallet(passphrase);
345  }
346  return false;
347 }
348 
349 bool WalletModel::setWalletLocked(bool locked, const SecureString &passPhrase) {
350  if (locked) {
351  // Lock
352  return m_wallet->lock();
353  } else {
354  // Unlock
355  return m_wallet->unlock(passPhrase);
356  }
357 }
358 
360  const SecureString &newPass) {
361  // Make sure wallet is locked before attempting pass change
362  m_wallet->lock();
363  return m_wallet->changeWalletPassphrase(oldPass, newPass);
364 }
365 
366 // Handlers for core signals
367 static void NotifyUnload(WalletModel *walletModel) {
368  qDebug() << "NotifyUnload";
369  bool invoked = QMetaObject::invokeMethod(walletModel, "unload");
370  assert(invoked);
371 }
372 
373 static void NotifyKeyStoreStatusChanged(WalletModel *walletmodel) {
374  qDebug() << "NotifyKeyStoreStatusChanged";
375  bool invoked = QMetaObject::invokeMethod(walletmodel, "updateStatus",
376  Qt::QueuedConnection);
377  assert(invoked);
378 }
379 
380 static void NotifyAddressBookChanged(WalletModel *walletmodel,
381  const CTxDestination &address,
382  const std::string &label, bool isMine,
383  const std::string &purpose,
384  ChangeType status) {
385  QString strAddress = QString::fromStdString(
386  EncodeCashAddr(address, walletmodel->getChainParams()));
387  QString strLabel = QString::fromStdString(label);
388  QString strPurpose = QString::fromStdString(purpose);
389 
390  qDebug() << "NotifyAddressBookChanged: " + strAddress + " " + strLabel +
391  " isMine=" + QString::number(isMine) +
392  " purpose=" + strPurpose +
393  " status=" + QString::number(status);
394  bool invoked = QMetaObject::invokeMethod(
395  walletmodel, "updateAddressBook", Qt::QueuedConnection,
396  Q_ARG(QString, strAddress), Q_ARG(QString, strLabel),
397  Q_ARG(bool, isMine), Q_ARG(QString, strPurpose), Q_ARG(int, status));
398  assert(invoked);
399 }
400 
401 static void NotifyTransactionChanged(WalletModel *walletmodel, const TxId &hash,
402  ChangeType status) {
403  Q_UNUSED(hash);
404  Q_UNUSED(status);
405  bool invoked = QMetaObject::invokeMethod(walletmodel, "updateTransaction",
406  Qt::QueuedConnection);
407  assert(invoked);
408 }
409 
410 static void ShowProgress(WalletModel *walletmodel, const std::string &title,
411  int nProgress) {
412  // emits signal "showProgress"
413  bool invoked = QMetaObject::invokeMethod(
414  walletmodel, "showProgress", Qt::QueuedConnection,
415  Q_ARG(QString, QString::fromStdString(title)), Q_ARG(int, nProgress));
416  assert(invoked);
417 }
418 
419 static void NotifyWatchonlyChanged(WalletModel *walletmodel,
420  bool fHaveWatchonly) {
421  bool invoked = QMetaObject::invokeMethod(walletmodel, "updateWatchOnlyFlag",
422  Qt::QueuedConnection,
423  Q_ARG(bool, fHaveWatchonly));
424  assert(invoked);
425 }
426 
427 static void NotifyCanGetAddressesChanged(WalletModel *walletmodel) {
428  bool invoked =
429  QMetaObject::invokeMethod(walletmodel, "canGetAddressesChanged");
430  assert(invoked);
431 }
432 
434  // Connect signals to wallet
435  m_handler_unload = m_wallet->handleUnload(std::bind(&NotifyUnload, this));
436  m_handler_status_changed = m_wallet->handleStatusChanged(
437  std::bind(&NotifyKeyStoreStatusChanged, this));
438  m_handler_address_book_changed = m_wallet->handleAddressBookChanged(
439  std::bind(NotifyAddressBookChanged, this, std::placeholders::_1,
440  std::placeholders::_2, std::placeholders::_3,
441  std::placeholders::_4, std::placeholders::_5));
442  m_handler_transaction_changed = m_wallet->handleTransactionChanged(
443  std::bind(NotifyTransactionChanged, this, std::placeholders::_1,
444  std::placeholders::_2));
445  m_handler_show_progress = m_wallet->handleShowProgress(std::bind(
446  ShowProgress, this, std::placeholders::_1, std::placeholders::_2));
447  m_handler_watch_only_changed = m_wallet->handleWatchOnlyChanged(
448  std::bind(NotifyWatchonlyChanged, this, std::placeholders::_1));
449  m_handler_can_get_addrs_changed = m_wallet->handleCanGetAddressesChanged(
450  std::bind(NotifyCanGetAddressesChanged, this));
451 }
452 
454  // Disconnect signals from wallet
455  m_handler_unload->disconnect();
456  m_handler_status_changed->disconnect();
457  m_handler_address_book_changed->disconnect();
458  m_handler_transaction_changed->disconnect();
459  m_handler_show_progress->disconnect();
460  m_handler_watch_only_changed->disconnect();
461  m_handler_can_get_addrs_changed->disconnect();
462 }
463 
464 // WalletModel::UnlockContext implementation
466  bool was_locked = getEncryptionStatus() == Locked;
467  if (was_locked) {
468  // Request UI to unlock wallet
469  Q_EMIT requireUnlock();
470  }
471  // If wallet is still locked, unlock was failed or cancelled, mark context
472  // as invalid
473  bool valid = getEncryptionStatus() != Locked;
474 
475  return UnlockContext(this, valid, was_locked);
476 }
477 
479  bool _relock)
480  : wallet(_wallet), valid(_valid), relock(_relock) {}
481 
483  if (valid && relock) {
484  wallet->setWalletLocked(true);
485  }
486 }
487 
489  // Transfer context; old object no longer relocks wallet
490  *this = rhs;
491  rhs.relock = false;
492 }
493 
495  std::vector<std::string> &vReceiveRequests) {
496  // receive request
497  vReceiveRequests = m_wallet->getDestValues("rr");
498 }
499 
500 bool WalletModel::saveReceiveRequest(const std::string &sAddress,
501  const int64_t nId,
502  const std::string &sRequest) {
503  CTxDestination dest = DecodeDestination(sAddress, getChainParams());
504 
505  std::stringstream ss;
506  ss << nId;
507  // "rr" prefix = "receive request" in destdata
508  std::string key = "rr" + ss.str();
509 
510  return sRequest.empty() ? m_wallet->eraseDestData(dest, key)
511  : m_wallet->addDestData(dest, key, sRequest);
512 }
513 
515  return !gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET);
516 }
517 
518 QString WalletModel::getWalletName() const {
519  return QString::fromStdString(m_wallet->getWalletName());
520 }
521 
523  const QString name = getWalletName();
524  return name.isEmpty() ? "[" + tr("default wallet") + "]" : name;
525 }
526 
528  return m_node.walletClient().getWallets().size() > 1;
529 }
530 
532  return Params();
533 }
534 
537 }
WalletModel::changePassphrase
bool changePassphrase(const SecureString &oldPass, const SecureString &newPass)
Definition: walletmodel.cpp:359
WalletModel::recentRequestsTableModel
RecentRequestsTableModel * recentRequestsTableModel
Definition: walletmodel.h:188
WalletModel::updateStatus
void updateStatus()
Definition: walletmodel.cpp:63
WalletModel::getOptionsModel
OptionsModel * getOptionsModel()
Definition: walletmodel.cpp:315
transactiontablemodel.h
ArgsManager::GetBoolArg
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
Definition: system.cpp:517
m_wallet
std::shared_ptr< CWallet > m_wallet
Definition: wallet.cpp:462
TransactionTableModel::updateConfirmations
void updateConfirmations()
Definition: transactiontablemodel.cpp:247
WalletModel::EncryptionStatus
EncryptionStatus
Definition: walletmodel.h:71
wallet.h
WalletModel::transactionTableModel
TransactionTableModel * transactionTableModel
Definition: walletmodel.h:187
WalletModel
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:47
WalletModel::m_handler_status_changed
std::unique_ptr< interfaces::Handler > m_handler_status_changed
Definition: walletmodel.h:170
WalletModel::m_handler_show_progress
std::unique_ptr< interfaces::Handler > m_handler_show_progress
Definition: walletmodel.h:173
key_io.h
WalletModel::TransactionCreationFailed
@ TransactionCreationFailed
Definition: walletmodel.h:66
walletmodel.h
GetScriptForDestination
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
Definition: standard.cpp:243
AddressTableModel
Qt model of the address book in the core.
Definition: addresstablemodel.h:24
bilingual_str
Bilingual messages:
Definition: translation.h:17
WalletModel::isWalletEnabled
static bool isWalletEnabled()
Definition: walletmodel.cpp:514
WalletModel::getAddressTableModel
AddressTableModel * getAddressTableModel()
Definition: walletmodel.cpp:319
WalletModel::DuplicateAddress
@ DuplicateAddress
Definition: walletmodel.h:64
CCoinControl
Coin Control Features.
Definition: coincontrol.h:21
WalletModel::sendCoins
SendCoinsReturn sendCoins(WalletModelTransaction &transaction)
Definition: walletmodel.cpp:248
WalletModel::AmountWithFeeExceedsBalance
@ AmountWithFeeExceedsBalance
Definition: walletmodel.h:63
WalletModel::Unlocked
@ Unlocked
Definition: walletmodel.h:77
node.h
handler.h
WalletModel::AbsurdFee
@ AbsurdFee
Definition: walletmodel.h:67
WalletModel::m_handler_watch_only_changed
std::unique_ptr< interfaces::Handler > m_handler_watch_only_changed
Definition: walletmodel.h:174
CChainParams
CChainParams defines various tweakable parameters of a given instance of the Bitcoin system.
Definition: chainparams.h:47
WalletModel::m_handler_transaction_changed
std::unique_ptr< interfaces::Handler > m_handler_transaction_changed
Definition: walletmodel.h:172
WalletModel::isMultiwallet
bool isMultiwallet()
Definition: walletmodel.cpp:527
WalletModel::m_wallet
std::unique_ptr< interfaces::Wallet > m_wallet
Definition: walletmodel.h:168
interfaces::WalletBalances::balanceChanged
bool balanceChanged(const WalletBalances &prev) const
Definition: wallet.h:360
WalletModel::getTransactionTableModel
TransactionTableModel * getTransactionTableModel()
Definition: walletmodel.cpp:323
WalletModel::~WalletModel
~WalletModel()
Definition: walletmodel.cpp:46
WalletModel::coinsSent
void coinsSent(interfaces::Wallet &wallet, SendCoinsRecipient recipient, QByteArray transaction)
WalletModel::requestUnlock
UnlockContext requestUnlock()
Definition: walletmodel.cpp:465
WalletModel::prepareTransaction
SendCoinsReturn prepareTransaction(WalletModelTransaction &transaction, const CCoinControl &coinControl)
Definition: walletmodel.cpp:133
WalletModel::setClientModel
void setClientModel(ClientModel *client_model)
Definition: walletmodel.cpp:56
Amount::zero
static constexpr Amount zero()
Definition: amount.h:42
SER_NETWORK
@ SER_NETWORK
Definition: serialize.h:165
NotifyCanGetAddressesChanged
static void NotifyCanGetAddressesChanged(WalletModel *walletmodel)
Definition: walletmodel.cpp:427
interfaces::WalletClient::getWallets
virtual std::vector< std::unique_ptr< Wallet > > getWallets()=0
Return interfaces for accessing wallets (if any).
WalletModel::m_handler_can_get_addrs_changed
std::unique_ptr< interfaces::Handler > m_handler_can_get_addrs_changed
Definition: walletmodel.h:175
WalletModel::addressTableModel
AddressTableModel * addressTableModel
Definition: walletmodel.h:186
SATOSHI
static constexpr Amount SATOSHI
Definition: amount.h:153
SendCoinsRecipient
Definition: sendcoinsrecipient.h:23
OptionsModel
Interface from Qt to configuration data structure for Bitcoin client.
Definition: optionsmodel.h:49
SecureString
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
Definition: secure.h:56
WalletModel::wallet
interfaces::Wallet & wallet() const
Definition: walletmodel.h:150
ChangeType
ChangeType
General change type (added, updated, removed).
Definition: ui_change_type.h:9
interfaces::WalletBalances
Collection of wallet balances.
Definition: wallet.h:351
WalletModel::AmountExceedsBalance
@ AmountExceedsBalance
Definition: walletmodel.h:62
NotifyAddressBookChanged
static void NotifyAddressBookChanged(WalletModel *walletmodel, const CTxDestination &address, const std::string &label, bool isMine, const std::string &purpose, ChangeType status)
Definition: walletmodel.cpp:380
WalletModel::m_handler_address_book_changed
std::unique_ptr< interfaces::Handler > m_handler_address_book_changed
Definition: walletmodel.h:171
WalletModel::encryptionStatusChanged
void encryptionStatusChanged()
WalletModel::unsubscribeFromCoreSignals
void unsubscribeFromCoreSignals()
Definition: walletmodel.cpp:453
interfaces::Wallet::commitTransaction
virtual void commitTransaction(CTransactionRef tx, WalletValueMap value_map, WalletOrderForm order_form)=0
Commit transaction.
WalletModel::m_cached_balances
interfaces::WalletBalances m_cached_balances
Definition: walletmodel.h:191
WalletModel::validateAddress
bool validateAddress(const QString &address)
Definition: walletmodel.cpp:128
WalletModel::updateWatchOnlyFlag
void updateWatchOnlyFlag(bool fHaveWatchonly)
Watch-only added.
Definition: walletmodel.cpp:123
WalletModel::saveReceiveRequest
bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest)
Definition: walletmodel.cpp:500
EncodeCashAddr
std::string EncodeCashAddr(const CTxDestination &dst, const CChainParams &params)
Definition: cashaddrenc.cpp:91
WalletModel::message
void message(const QString &title, const QString &message, unsigned int style)
RecentRequestsTableModel
Model for list of recently generated payment requests / bitcoincash: URIs.
Definition: recentrequeststablemodel.h:51
recentrequeststablemodel.h
WalletModel::getChainParams
const CChainParams & getChainParams() const
Definition: walletmodel.cpp:531
interfaces::Node::walletClient
virtual WalletClient & walletClient()=0
Get wallet client.
WalletModel::getEncryptionStatus
EncryptionStatus getEncryptionStatus() const
Definition: walletmodel.cpp:331
WalletModel::Unencrypted
@ Unencrypted
Definition: walletmodel.h:73
Amount::amount
int64_t amount
Definition: amount.h:21
WalletModel::loadReceiveRequests
void loadReceiveRequests(std::vector< std::string > &vReceiveRequests)
Definition: walletmodel.cpp:494
WalletModel::getWalletName
QString getWalletName() const
Definition: walletmodel.cpp:518
NotifyTransactionChanged
static void NotifyTransactionChanged(WalletModel *walletmodel, const TxId &hash, ChangeType status)
Definition: walletmodel.cpp:401
WalletModel::checkBalanceChanged
void checkBalanceChanged(const interfaces::WalletBalances &new_balances)
Definition: walletmodel.cpp:102
TxId
A TxId is the identifier of a transaction.
Definition: txid.h:14
WalletModel::getRecentRequestsTableModel
RecentRequestsTableModel * getRecentRequestsTableModel()
Definition: walletmodel.cpp:327
WalletModel::Locked
@ Locked
Definition: walletmodel.h:75
Amount
Definition: amount.h:19
WalletModelTransaction::getRecipients
QList< SendCoinsRecipient > getRecipients() const
Definition: walletmodeltransaction.cpp:17
CScript
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:430
CDataStream::size
size_type size() const
Definition: streams.h:280
BlockHash
A BlockHash is a unqiue identifier for a block.
Definition: blockhash.h:13
NotifyKeyStoreStatusChanged
static void NotifyKeyStoreStatusChanged(WalletModel *walletmodel)
Definition: walletmodel.cpp:373
name
const char * name
Definition: rest.cpp:43
ui_interface.h
system.h
m_node
NodeContext & m_node
Definition: chain.cpp:485
CClientUIInterface::MSG_ERROR
@ MSG_ERROR
Definition: ui_interface.h:73
ClientModel
Model for Bitcoin network client.
Definition: clientmodel.h:36
WalletModel::m_handler_unload
std::unique_ptr< interfaces::Handler > m_handler_unload
Definition: walletmodel.h:169
TransactionTableModel
UI model for the transaction table of a wallet.
Definition: transactiontablemodel.h:27
WalletModel::OK
@ OK
Definition: walletmodel.h:59
WalletModel::getLastBlockProcessed
BlockHash getLastBlockProcessed() const
Definition: walletmodel.cpp:535
WalletModel::setWalletEncrypted
bool setWalletEncrypted(bool encrypted, const SecureString &passphrase)
Definition: walletmodel.cpp:341
guiconstants.h
WalletModel::optionsModel
OptionsModel * optionsModel
Definition: walletmodel.h:184
WalletModel::updateTransaction
void updateTransaction()
New transaction, or transaction changed status.
Definition: walletmodel.cpp:110
WalletModel::UnlockContext
Definition: walletmodel.h:115
translation.h
WalletModel::InvalidAmount
@ InvalidAmount
Definition: walletmodel.h:60
WalletModel::UnlockContext::UnlockContext
UnlockContext(WalletModel *wallet, bool valid, bool relock)
Definition: walletmodel.cpp:478
gArgs
ArgsManager gArgs
Definition: system.cpp:75
WalletModel::timer
QTimer * timer
Definition: walletmodel.h:193
WalletModel::InvalidAddress
@ InvalidAddress
Definition: walletmodel.h:61
WalletModel::fForceCheckBalanceChanged
bool fForceCheckBalanceChanged
Definition: walletmodel.h:180
WalletModel::fHaveWatchOnly
bool fHaveWatchOnly
Definition: walletmodel.h:179
NotifyUnload
static void NotifyUnload(WalletModel *walletModel)
Definition: walletmodel.cpp:367
WalletModel::requireUnlock
void requireUnlock()
Params
const CChainParams & Params()
Return the currently selected parameters.
Definition: chainparams.cpp:506
WalletModel::SendCoinsReturn
Definition: walletmodel.h:91
WalletModel::m_client_model
ClientModel * m_client_model
Definition: walletmodel.h:176
WalletModel::updateAddressBook
void updateAddressBook(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
New, updated or removed address book entry.
Definition: walletmodel.cpp:115
IsValidDestinationString
bool IsValidDestinationString(const std::string &str, const CChainParams &params)
Definition: key_io.cpp:186
CDataStream
Double ended buffer combining vector and stream-like interfaces.
Definition: streams.h:197
WalletModel::m_node
interfaces::Node & m_node
Definition: walletmodel.h:177
WalletModel::subscribeToCoreSignals
void subscribeToCoreSignals()
Definition: walletmodel.cpp:433
WalletModel::startPollBalance
void startPollBalance()
Definition: walletmodel.cpp:50
WalletModel::PaymentRequestExpired
@ PaymentRequestExpired
Definition: walletmodel.h:68
ShowProgress
static void ShowProgress(WalletModel *walletmodel, const std::string &title, int nProgress)
Definition: walletmodel.cpp:410
error
bool error(const char *fmt, const Args &... args)
Definition: system.h:48
AddressTableModel::updateEntry
void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
Definition: addresstablemodel.cpp:315
WalletModel::getDisplayName
QString getDisplayName() const
Definition: walletmodel.cpp:522
NotifyWatchonlyChanged
static void NotifyWatchonlyChanged(WalletModel *walletmodel, bool fHaveWatchonly)
Definition: walletmodel.cpp:419
WalletModel::WalletModel
WalletModel(std::unique_ptr< interfaces::Wallet > wallet, ClientModel &client_model, const PlatformStyle *platformStyle, QObject *parent=nullptr)
Definition: walletmodel.cpp:30
coincontrol.h
WalletModel::UnlockContext::CopyFrom
void CopyFrom(UnlockContext &&rhs)
Definition: walletmodel.cpp:488
WalletModel::balanceChanged
void balanceChanged(const interfaces::WalletBalances &balances)
PlatformStyle
Definition: platformstyle.h:13
DecodeDestination
CTxDestination DecodeDestination(const std::string &addr, const CChainParams &params)
Definition: key_io.cpp:177
WalletModel::pollBalanceChanged
void pollBalanceChanged()
Current, immature or unconfirmed balance might have changed - emit 'balanceChanged' if so.
Definition: walletmodel.cpp:71
CRecipient
Definition: wallet.h:220
addresstablemodel.h
WalletModelTransaction::getWtx
CTransactionRef & getWtx()
Definition: walletmodeltransaction.cpp:21
WalletModelTransaction
Data model for a walletmodel transaction.
Definition: walletmodeltransaction.h:22
WalletModel::notifyWatchonlyChanged
void notifyWatchonlyChanged(bool fHaveWatchonly)
WalletModel::cachedEncryptionStatus
EncryptionStatus cachedEncryptionStatus
Definition: walletmodel.h:192
CTxDestination
boost::variant< CNoDestination, PKHash, ScriptHash > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:132
cashaddrenc.h
WalletModelTransaction::setTransactionFee
void setTransactionFee(const Amount newFee)
Definition: walletmodeltransaction.cpp:33
WalletModel::setWalletLocked
bool setWalletLocked(bool locked, const SecureString &passPhrase=SecureString())
Definition: walletmodel.cpp:349
clientmodel.h
WalletModel::UnlockContext::~UnlockContext
~UnlockContext()
Definition: walletmodel.cpp:482
WalletModelTransaction::reassignAmounts
void reassignAmounts(int nChangePosRet)
Definition: walletmodeltransaction.cpp:37
MODEL_UPDATE_DELAY
static const int MODEL_UPDATE_DELAY
Definition: guiconstants.h:11
PROTOCOL_VERSION
static const int PROTOCOL_VERSION
network protocol versioning
Definition: version.h:11
DEFAULT_DISABLE_WALLET
static const bool DEFAULT_DISABLE_WALLET
Definition: wallet.h:106
WalletModel::m_cached_last_update_tip
BlockHash m_cached_last_update_tip
Definition: walletmodel.h:196
paymentserver.h
ClientModel::getBestBlockHash
BlockHash getBestBlockHash()
Definition: clientmodel.cpp:115