Bitcoin Core  0.19.99
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 #if defined(HAVE_CONFIG_H)
7 #endif
8 
9 #include <qt/walletmodel.h>
10 
11 #include <qt/addresstablemodel.h>
12 #include <qt/guiconstants.h>
13 #include <qt/guiutil.h>
14 #include <qt/optionsmodel.h>
15 #include <qt/paymentserver.h>
17 #include <qt/sendcoinsdialog.h>
19 
20 #include <interfaces/handler.h>
21 #include <interfaces/node.h>
22 #include <key_io.h>
23 #include <ui_interface.h>
24 #include <util/system.h> // for GetBoolArg
25 #include <wallet/coincontrol.h>
26 #include <wallet/wallet.h> // for CRecipient
27 
28 #include <stdint.h>
29 
30 #include <QDebug>
31 #include <QMessageBox>
32 #include <QSet>
33 #include <QTimer>
34 
35 
36 WalletModel::WalletModel(std::unique_ptr<interfaces::Wallet> wallet, interfaces::Node& node, const PlatformStyle *platformStyle, OptionsModel *_optionsModel, QObject *parent) :
37  QObject(parent), m_wallet(std::move(wallet)), m_node(node), optionsModel(_optionsModel), addressTableModel(nullptr),
38  transactionTableModel(nullptr),
39  recentRequestsTableModel(nullptr),
40  cachedEncryptionStatus(Unencrypted),
41  cachedNumBlocks(0)
42 {
43  fHaveWatchOnly = m_wallet->haveWatchOnly();
45  transactionTableModel = new TransactionTableModel(platformStyle, this);
47 
49 }
50 
52 {
54 }
55 
57 {
58  // This timer will be fired repeatedly to update the balance
59  QTimer* timer = new QTimer(this);
60  connect(timer, &QTimer::timeout, this, &WalletModel::pollBalanceChanged);
61  timer->start(MODEL_UPDATE_DELAY);
62 }
63 
65 {
66  EncryptionStatus newEncryptionStatus = getEncryptionStatus();
67 
68  if(cachedEncryptionStatus != newEncryptionStatus) {
69  Q_EMIT encryptionStatusChanged();
70  }
71 }
72 
74 {
75  // Try to get balances and return early if locks can't be acquired. This
76  // avoids the GUI from getting stuck on periodical polls if the core is
77  // holding the locks for a longer time - for example, during a wallet
78  // rescan.
79  interfaces::WalletBalances new_balances;
80  int numBlocks = -1;
81  if (!m_wallet->tryGetBalances(new_balances, numBlocks, fForceCheckBalanceChanged, cachedNumBlocks)) {
82  return;
83  }
84 
86 
87  // Balance and number of transactions might have changed
88  cachedNumBlocks = numBlocks;
89 
90  checkBalanceChanged(new_balances);
93 }
94 
96 {
97  if(new_balances.balanceChanged(m_cached_balances)) {
98  m_cached_balances = new_balances;
99  Q_EMIT balanceChanged(new_balances);
100  }
101 }
102 
104 {
105  // Balance and number of transactions might have changed
107 }
108 
109 void WalletModel::updateAddressBook(const QString &address, const QString &label,
110  bool isMine, const QString &purpose, int status)
111 {
113  addressTableModel->updateEntry(address, label, isMine, purpose, status);
114 }
115 
116 void WalletModel::updateWatchOnlyFlag(bool fHaveWatchonly)
117 {
118  fHaveWatchOnly = fHaveWatchonly;
119  Q_EMIT notifyWatchonlyChanged(fHaveWatchonly);
120 }
121 
122 bool WalletModel::validateAddress(const QString &address)
123 {
124  return IsValidDestinationString(address.toStdString());
125 }
126 
128 {
129  CAmount total = 0;
130  bool fSubtractFeeFromAmount = false;
131  QList<SendCoinsRecipient> recipients = transaction.getRecipients();
132  std::vector<CRecipient> vecSend;
133 
134  if(recipients.empty())
135  {
136  return OK;
137  }
138 
139  QSet<QString> setAddress; // Used to detect duplicates
140  int nAddresses = 0;
141 
142  // Pre-check input data for validity
143  for (const SendCoinsRecipient &rcp : recipients)
144  {
145  if (rcp.fSubtractFeeFromAmount)
146  fSubtractFeeFromAmount = true;
147  { // User-entered bitcoin address / amount:
148  if(!validateAddress(rcp.address))
149  {
150  return InvalidAddress;
151  }
152  if(rcp.amount <= 0)
153  {
154  return InvalidAmount;
155  }
156  setAddress.insert(rcp.address);
157  ++nAddresses;
158 
159  CScript scriptPubKey = GetScriptForDestination(DecodeDestination(rcp.address.toStdString()));
160  CRecipient recipient = {scriptPubKey, rcp.amount, rcp.fSubtractFeeFromAmount};
161  vecSend.push_back(recipient);
162 
163  total += rcp.amount;
164  }
165  }
166  if(setAddress.size() != nAddresses)
167  {
168  return DuplicateAddress;
169  }
170 
171  CAmount nBalance = m_wallet->getAvailableBalance(coinControl);
172 
173  if(total > nBalance)
174  {
175  return AmountExceedsBalance;
176  }
177 
178  {
179  CAmount nFeeRequired = 0;
180  int nChangePosRet = -1;
181  std::string strFailReason;
182 
183  auto& newTx = transaction.getWtx();
184  newTx = m_wallet->createTransaction(vecSend, coinControl, !wallet().privateKeysDisabled() /* sign */, nChangePosRet, nFeeRequired, strFailReason);
185  transaction.setTransactionFee(nFeeRequired);
186  if (fSubtractFeeFromAmount && newTx)
187  transaction.reassignAmounts(nChangePosRet);
188 
189  if(!newTx)
190  {
191  if(!fSubtractFeeFromAmount && (total + nFeeRequired) > nBalance)
192  {
194  }
195  Q_EMIT message(tr("Send Coins"), QString::fromStdString(strFailReason),
198  }
199 
200  // Reject absurdly high fee. (This can never happen because the
201  // wallet never creates transactions with fee greater than
202  // m_default_max_tx_fee. This merely a belt-and-suspenders check).
203  if (nFeeRequired > m_wallet->getDefaultMaxTxFee()) {
204  return AbsurdFee;
205  }
206  }
207 
208  return SendCoinsReturn(OK);
209 }
210 
212 {
213  QByteArray transaction_array; /* store serialized transaction */
214 
215  {
216  std::vector<std::pair<std::string, std::string>> vOrderForm;
217  for (const SendCoinsRecipient &rcp : transaction.getRecipients())
218  {
219  if (!rcp.message.isEmpty()) // Message from normal bitcoin:URI (bitcoin:123...?message=example)
220  vOrderForm.emplace_back("Message", rcp.message.toStdString());
221  }
222 
223  auto& newTx = transaction.getWtx();
224  wallet().commitTransaction(newTx, {} /* mapValue */, std::move(vOrderForm));
225 
227  ssTx << *newTx;
228  transaction_array.append(&(ssTx[0]), ssTx.size());
229  }
230 
231  // Add addresses / update labels that we've sent to the address book,
232  // and emit coinsSent signal for each recipient
233  for (const SendCoinsRecipient &rcp : transaction.getRecipients())
234  {
235  {
236  std::string strAddress = rcp.address.toStdString();
237  CTxDestination dest = DecodeDestination(strAddress);
238  std::string strLabel = rcp.label.toStdString();
239  {
240  // Check if we have a new address or an updated label
241  std::string name;
242  if (!m_wallet->getAddress(
243  dest, &name, /* is_mine= */ nullptr, /* purpose= */ nullptr))
244  {
245  m_wallet->setAddressBook(dest, strLabel, "send");
246  }
247  else if (name != strLabel)
248  {
249  m_wallet->setAddressBook(dest, strLabel, ""); // "" means don't change purpose
250  }
251  }
252  }
253  Q_EMIT coinsSent(this, rcp, transaction_array);
254  }
255 
256  checkBalanceChanged(m_wallet->getBalances()); // update balance immediately, otherwise there could be a short noticeable delay until pollBalanceChanged hits
257 
258  return SendCoinsReturn(OK);
259 }
260 
262 {
263  return optionsModel;
264 }
265 
267 {
268  return addressTableModel;
269 }
270 
272 {
273  return transactionTableModel;
274 }
275 
277 {
279 }
280 
282 {
283  if(!m_wallet->isCrypted())
284  {
285  return Unencrypted;
286  }
287  else if(m_wallet->isLocked())
288  {
289  return Locked;
290  }
291  else
292  {
293  return Unlocked;
294  }
295 }
296 
297 bool WalletModel::setWalletEncrypted(bool encrypted, const SecureString &passphrase)
298 {
299  if(encrypted)
300  {
301  // Encrypt
302  return m_wallet->encryptWallet(passphrase);
303  }
304  else
305  {
306  // Decrypt -- TODO; not supported yet
307  return false;
308  }
309 }
310 
311 bool WalletModel::setWalletLocked(bool locked, const SecureString &passPhrase)
312 {
313  if(locked)
314  {
315  // Lock
316  return m_wallet->lock();
317  }
318  else
319  {
320  // Unlock
321  return m_wallet->unlock(passPhrase);
322  }
323 }
324 
325 bool WalletModel::changePassphrase(const SecureString &oldPass, const SecureString &newPass)
326 {
327  m_wallet->lock(); // Make sure wallet is locked before attempting pass change
328  return m_wallet->changeWalletPassphrase(oldPass, newPass);
329 }
330 
331 // Handlers for core signals
332 static void NotifyUnload(WalletModel* walletModel)
333 {
334  qDebug() << "NotifyUnload";
335  bool invoked = QMetaObject::invokeMethod(walletModel, "unload");
336  assert(invoked);
337 }
338 
339 static void NotifyKeyStoreStatusChanged(WalletModel *walletmodel)
340 {
341  qDebug() << "NotifyKeyStoreStatusChanged";
342  bool invoked = QMetaObject::invokeMethod(walletmodel, "updateStatus", Qt::QueuedConnection);
343  assert(invoked);
344 }
345 
346 static void NotifyAddressBookChanged(WalletModel *walletmodel,
347  const CTxDestination &address, const std::string &label, bool isMine,
348  const std::string &purpose, ChangeType status)
349 {
350  QString strAddress = QString::fromStdString(EncodeDestination(address));
351  QString strLabel = QString::fromStdString(label);
352  QString strPurpose = QString::fromStdString(purpose);
353 
354  qDebug() << "NotifyAddressBookChanged: " + strAddress + " " + strLabel + " isMine=" + QString::number(isMine) + " purpose=" + strPurpose + " status=" + QString::number(status);
355  bool invoked = QMetaObject::invokeMethod(walletmodel, "updateAddressBook", Qt::QueuedConnection,
356  Q_ARG(QString, strAddress),
357  Q_ARG(QString, strLabel),
358  Q_ARG(bool, isMine),
359  Q_ARG(QString, strPurpose),
360  Q_ARG(int, status));
361  assert(invoked);
362 }
363 
364 static void NotifyTransactionChanged(WalletModel *walletmodel, const uint256 &hash, ChangeType status)
365 {
366  Q_UNUSED(hash);
367  Q_UNUSED(status);
368  bool invoked = QMetaObject::invokeMethod(walletmodel, "updateTransaction", Qt::QueuedConnection);
369  assert(invoked);
370 }
371 
372 static void ShowProgress(WalletModel *walletmodel, const std::string &title, int nProgress)
373 {
374  // emits signal "showProgress"
375  bool invoked = QMetaObject::invokeMethod(walletmodel, "showProgress", Qt::QueuedConnection,
376  Q_ARG(QString, QString::fromStdString(title)),
377  Q_ARG(int, nProgress));
378  assert(invoked);
379 }
380 
381 static void NotifyWatchonlyChanged(WalletModel *walletmodel, bool fHaveWatchonly)
382 {
383  bool invoked = QMetaObject::invokeMethod(walletmodel, "updateWatchOnlyFlag", Qt::QueuedConnection,
384  Q_ARG(bool, fHaveWatchonly));
385  assert(invoked);
386 }
387 
388 static void NotifyCanGetAddressesChanged(WalletModel* walletmodel)
389 {
390  bool invoked = QMetaObject::invokeMethod(walletmodel, "canGetAddressesChanged");
391  assert(invoked);
392 }
393 
395 {
396  // Connect signals to wallet
397  m_handler_unload = m_wallet->handleUnload(std::bind(&NotifyUnload, this));
398  m_handler_status_changed = m_wallet->handleStatusChanged(std::bind(&NotifyKeyStoreStatusChanged, this));
399  m_handler_address_book_changed = m_wallet->handleAddressBookChanged(std::bind(NotifyAddressBookChanged, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5));
400  m_handler_transaction_changed = m_wallet->handleTransactionChanged(std::bind(NotifyTransactionChanged, this, std::placeholders::_1, std::placeholders::_2));
401  m_handler_show_progress = m_wallet->handleShowProgress(std::bind(ShowProgress, this, std::placeholders::_1, std::placeholders::_2));
402  m_handler_watch_only_changed = m_wallet->handleWatchOnlyChanged(std::bind(NotifyWatchonlyChanged, this, std::placeholders::_1));
403  m_handler_can_get_addrs_changed = m_wallet->handleCanGetAddressesChanged(boost::bind(NotifyCanGetAddressesChanged, this));
404 }
405 
407 {
408  // Disconnect signals from wallet
409  m_handler_unload->disconnect();
410  m_handler_status_changed->disconnect();
411  m_handler_address_book_changed->disconnect();
412  m_handler_transaction_changed->disconnect();
413  m_handler_show_progress->disconnect();
414  m_handler_watch_only_changed->disconnect();
415  m_handler_can_get_addrs_changed->disconnect();
416 }
417 
418 // WalletModel::UnlockContext implementation
420 {
421  bool was_locked = getEncryptionStatus() == Locked;
422  if(was_locked)
423  {
424  // Request UI to unlock wallet
425  Q_EMIT requireUnlock();
426  }
427  // If wallet is still locked, unlock was failed or cancelled, mark context as invalid
428  bool valid = getEncryptionStatus() != Locked;
429 
430  return UnlockContext(this, valid, was_locked);
431 }
432 
433 WalletModel::UnlockContext::UnlockContext(WalletModel *_wallet, bool _valid, bool _relock):
434  wallet(_wallet),
435  valid(_valid),
436  relock(_relock)
437 {
438 }
439 
441 {
442  if(valid && relock)
443  {
444  wallet->setWalletLocked(true);
445  }
446 }
447 
449 {
450  // Transfer context; old object no longer relocks wallet
451  *this = rhs;
452  rhs.relock = false;
453 }
454 
455 void WalletModel::loadReceiveRequests(std::vector<std::string>& vReceiveRequests)
456 {
457  vReceiveRequests = m_wallet->getDestValues("rr"); // receive request
458 }
459 
460 bool WalletModel::saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest)
461 {
462  CTxDestination dest = DecodeDestination(sAddress);
463 
464  std::stringstream ss;
465  ss << nId;
466  std::string key = "rr" + ss.str(); // "rr" prefix = "receive request" in destdata
467 
468  if (sRequest.empty())
469  return m_wallet->eraseDestData(dest, key);
470  else
471  return m_wallet->addDestData(dest, key, sRequest);
472 }
473 
474 bool WalletModel::bumpFee(uint256 hash, uint256& new_hash)
475 {
476  CCoinControl coin_control;
477  coin_control.m_signal_bip125_rbf = true;
478  std::vector<std::string> errors;
479  CAmount old_fee;
480  CAmount new_fee;
482  if (!m_wallet->createBumpTransaction(hash, coin_control, errors, old_fee, new_fee, mtx)) {
483  QMessageBox::critical(nullptr, tr("Fee bump error"), tr("Increasing transaction fee failed") + "<br />(" +
484  (errors.size() ? QString::fromStdString(errors[0]) : "") +")");
485  return false;
486  }
487 
488  const bool create_psbt = m_wallet->privateKeysDisabled();
489 
490  // allow a user based fee verification
491  QString questionString = create_psbt ? tr("Do you want to draft a transaction with fee increase?") : tr("Do you want to increase the fee?");
492  questionString.append("<br />");
493  questionString.append("<table style=\"text-align: left;\">");
494  questionString.append("<tr><td>");
495  questionString.append(tr("Current fee:"));
496  questionString.append("</td><td>");
497  questionString.append(BitcoinUnits::formatHtmlWithUnit(getOptionsModel()->getDisplayUnit(), old_fee));
498  questionString.append("</td></tr><tr><td>");
499  questionString.append(tr("Increase:"));
500  questionString.append("</td><td>");
501  questionString.append(BitcoinUnits::formatHtmlWithUnit(getOptionsModel()->getDisplayUnit(), new_fee - old_fee));
502  questionString.append("</td></tr><tr><td>");
503  questionString.append(tr("New fee:"));
504  questionString.append("</td><td>");
505  questionString.append(BitcoinUnits::formatHtmlWithUnit(getOptionsModel()->getDisplayUnit(), new_fee));
506  questionString.append("</td></tr></table>");
507  SendConfirmationDialog confirmationDialog(tr("Confirm fee bump"), questionString);
508  confirmationDialog.exec();
509  QMessageBox::StandardButton retval = static_cast<QMessageBox::StandardButton>(confirmationDialog.result());
510 
511  // cancel sign&broadcast if user doesn't want to bump the fee
512  if (retval != QMessageBox::Yes) {
513  return false;
514  }
515 
517  if(!ctx.isValid())
518  {
519  return false;
520  }
521 
522  // Short-circuit if we are returning a bumped transaction PSBT to clipboard
523  if (create_psbt) {
524  PartiallySignedTransaction psbtx(mtx);
525  bool complete = false;
526  const TransactionError err = wallet().fillPSBT(SIGHASH_ALL, false /* sign */, true /* bip32derivs */, psbtx, complete);
527  if (err != TransactionError::OK || complete) {
528  QMessageBox::critical(nullptr, tr("Fee bump error"), tr("Can't draft transaction."));
529  return false;
530  }
531  // Serialize the PSBT
533  ssTx << psbtx;
534  GUIUtil::setClipboard(EncodeBase64(ssTx.str()).c_str());
535  Q_EMIT message(tr("PSBT copied"), "Copied to clipboard", CClientUIInterface::MSG_INFORMATION);
536  return true;
537  }
538 
539  // sign bumped transaction
540  if (!m_wallet->signBumpTransaction(mtx)) {
541  QMessageBox::critical(nullptr, tr("Fee bump error"), tr("Can't sign transaction."));
542  return false;
543  }
544  // commit the bumped transaction
545  if(!m_wallet->commitBumpTransaction(hash, std::move(mtx), errors, new_hash)) {
546  QMessageBox::critical(nullptr, tr("Fee bump error"), tr("Could not commit transaction") + "<br />(" +
547  QString::fromStdString(errors[0])+")");
548  return false;
549  }
550  return true;
551 }
552 
554 {
555  return !gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET);
556 }
557 
559 {
560  return QString::fromStdString(m_wallet->getWalletName());
561 }
562 
564 {
565  const QString name = getWalletName();
566  return name.isEmpty() ? "["+tr("default wallet")+"]" : name;
567 }
568 
570 {
571  return m_node.getWallets().size() > 1;
572 }
void loadReceiveRequests(std::vector< std::string > &vReceiveRequests)
Model for list of recently generated payment requests / bitcoin: URIs.
TransactionTableModel * transactionTableModel
Definition: walletmodel.h:172
std::shared_ptr< CWallet > m_wallet
Definition: wallet.cpp:501
interfaces::Wallet & wallet() const
Definition: walletmodel.h:145
void coinsSent(WalletModel *wallet, SendCoinsRecipient recipient, QByteArray transaction)
RecentRequestsTableModel * recentRequestsTableModel
Definition: walletmodel.h:173
std::unique_ptr< interfaces::Handler > m_handler_address_book_changed
Definition: walletmodel.h:157
static bool isWalletEnabled()
void startPollBalance()
Definition: walletmodel.cpp:56
bool IsValidDestinationString(const std::string &str, const CChainParams &params)
Definition: key_io.cpp:220
NodeContext & m_node
Definition: chain.cpp:382
UnlockContext requestUnlock()
std::unique_ptr< interfaces::Handler > m_handler_unload
Definition: walletmodel.h:155
void unsubscribeFromCoreSignals()
static QString formatHtmlWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as HTML string (with unit)
std::string str() const
Definition: streams.h:279
std::basic_string< char, std::char_traits< char >, secure_allocator< char > > SecureString
Definition: secure.h:60
SendCoinsReturn sendCoins(WalletModelTransaction &transaction)
QList< SendCoinsRecipient > getRecipients() const
static const bool DEFAULT_DISABLE_WALLET
Definition: wallet.h:85
std::unique_ptr< interfaces::Handler > m_handler_status_changed
Definition: walletmodel.h:156
A version of CTransaction with the PSBT format.
Definition: psbt.h:388
Double ended buffer combining vector and stream-like interfaces.
Definition: streams.h:201
bool GetBoolArg(const std::string &strArg, bool fDefault) const
Return boolean argument or default value.
Definition: system.cpp:384
virtual std::vector< std::unique_ptr< Wallet > > getWallets()=0
Return interfaces for accessing wallets (if any).
AddressTableModel * getAddressTableModel()
Coin Control Features.
Definition: coincontrol.h:22
void updateStatus()
Definition: walletmodel.cpp:64
EncryptionStatus getEncryptionStatus() const
void setTransactionFee(const CAmount &newFee)
bool bumpFee(uint256 hash, uint256 &new_hash)
UnlockContext(WalletModel *wallet, bool valid, bool relock)
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
Optional< bool > m_signal_bip125_rbf
Override the wallet&#39;s m_signal_rbf if set.
Definition: coincontrol.h:40
static void NotifyCanGetAddressesChanged(WalletModel *walletmodel)
void push_back(const T &value)
Definition: prevector.h:437
size_type size() const
Definition: streams.h:292
void updateTransaction()
ChangeType
General change type (added, updated, removed).
Definition: ui_interface.h:21
Collection of wallet balances.
Definition: wallet.h:317
void setClipboard(const QString &str)
Definition: guiutil.cpp:704
const char * name
Definition: rest.cpp:40
bool changePassphrase(const SecureString &oldPass, const SecureString &newPass)
static void NotifyAddressBookChanged(WalletModel *walletmodel, const CTxDestination &address, const std::string &label, bool isMine, const std::string &purpose, ChangeType status)
static secp256k1_context * ctx
Definition: tests.c:46
void reassignAmounts(int nChangePosRet)
std::string EncodeBase64(const unsigned char *pch, size_t len)
std::unique_ptr< interfaces::Wallet > m_wallet
Definition: walletmodel.h:154
SendCoinsReturn prepareTransaction(WalletModelTransaction &transaction, const CCoinControl &coinControl)
void encryptionStatusChanged()
OptionsModel * optionsModel
Definition: walletmodel.h:169
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
Definition: standard.cpp:289
QString getWalletName() const
TransactionTableModel * getTransactionTableModel()
EncryptionStatus cachedEncryptionStatus
Definition: walletmodel.h:177
UI model for the transaction table of a wallet.
Qt model of the address book in the core.
static const int MODEL_UPDATE_DELAY
Definition: guiconstants.h:11
bool setWalletLocked(bool locked, const SecureString &passPhrase=SecureString())
std::unique_ptr< interfaces::Handler > m_handler_show_progress
Definition: walletmodel.h:159
bool validateAddress(const QString &address)
static void NotifyKeyStoreStatusChanged(WalletModel *walletmodel)
void updateWatchOnlyFlag(bool fHaveWatchonly)
static void NotifyUnload(WalletModel *walletModel)
256-bit opaque blob.
Definition: uint256.h:120
int cachedNumBlocks
Definition: walletmodel.h:178
WalletModel(std::unique_ptr< interfaces::Wallet > wallet, interfaces::Node &node, const PlatformStyle *platformStyle, OptionsModel *optionsModel, QObject *parent=nullptr)
Definition: walletmodel.cpp:36
CTxDestination DecodeDestination(const std::string &str)
Definition: key_io.cpp:215
void requireUnlock()
bool fForceCheckBalanceChanged
Definition: walletmodel.h:165
std::unique_ptr< interfaces::Handler > m_handler_can_get_addrs_changed
Definition: walletmodel.h:161
RecentRequestsTableModel * getRecentRequestsTableModel()
Interface from Qt to configuration data structure for Bitcoin client.
Definition: optionsmodel.h:36
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:390
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:50
interfaces::WalletBalances m_cached_balances
Definition: walletmodel.h:176
static const int PROTOCOL_VERSION
network protocol versioning
Definition: version.h:12
bool setWalletEncrypted(bool encrypted, const SecureString &passphrase)
interfaces::Node & m_node
Definition: walletmodel.h:162
static void NotifyTransactionChanged(WalletModel *walletmodel, const uint256 &hash, ChangeType status)
void message(const QString &title, const QString &message, unsigned int style)
ArgsManager gArgs
Definition: system.cpp:76
TransactionError
Definition: error.h:22
void CopyFrom(UnlockContext &&rhs)
void notifyWatchonlyChanged(bool fHaveWatchonly)
Data model for a walletmodel transaction.
std::string EncodeDestination(const CTxDestination &dest)
Definition: key_io.cpp:210
QString getDisplayName() const
A mutable version of CTransaction.
Definition: transaction.h:366
AddressTableModel * addressTableModel
Definition: walletmodel.h:171
static void NotifyWatchonlyChanged(WalletModel *walletmodel, bool fHaveWatchonly)
std::unique_ptr< interfaces::Handler > m_handler_transaction_changed
Definition: walletmodel.h:158
bool isMultiwallet()
bool fHaveWatchOnly
Definition: walletmodel.h:164
virtual void commitTransaction(CTransactionRef tx, WalletValueMap value_map, WalletOrderForm order_form)=0
Commit transaction.
void checkBalanceChanged(const interfaces::WalletBalances &new_balances)
Definition: walletmodel.cpp:95
boost::variant< CNoDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessUnknown > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:143
static void ShowProgress(WalletModel *walletmodel, const std::string &title, int nProgress)
bool saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest)
bool balanceChanged(const WalletBalances &prev) const
Definition: wallet.h:327
void updateAddressBook(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
Top-level interface for a bitcoin node (bitcoind process).
Definition: node.h:39
void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
void balanceChanged(const interfaces::WalletBalances &balances)
std::unique_ptr< interfaces::Handler > m_handler_watch_only_changed
Definition: walletmodel.h:160
void pollBalanceChanged()
Definition: walletmodel.cpp:73
OptionsModel * getOptionsModel()
void subscribeToCoreSignals()
Predefined combinations for certain default usage cases.
Definition: ui_interface.h:74