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