PRCYCoin  2.0.0.7rc1
P2P Digital Currency
coincontroldialog.cpp
Go to the documentation of this file.
1 // Copyright (c) 2011-2014 The Bitcoin developers
2 // Copyright (c) 2014-2015 The Dash developers
3 // Copyright (c) 2015-2018 The PIVX developers
4 // Copyright (c) 2018-2020 The DAPS Project developers
5 // Distributed under the MIT/X11 software license, see the accompanying
6 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
7 
8 #include "coincontroldialog.h"
9 #include "ui_coincontroldialog.h"
10 
11 #include "addresstablemodel.h"
12 #include "bitcoinunits.h"
13 #include "guiutil.h"
14 #include "init.h"
15 #include "optionsmodel.h"
16 #include "walletmodel.h"
17 
18 #include "coincontrol.h"
19 #include "main.h"
20 #include "wallet/wallet.h"
21 
22 #include <boost/assign/list_of.hpp> // for 'map_list_of()'
23 
24 #include <QApplication>
25 #include <QCheckBox>
26 #include <QCursor>
27 #include <QDialogButtonBox>
28 #include <QFlags>
29 #include <QIcon>
30 #include <QSettings>
31 #include <QString>
32 #include <QTreeWidget>
33 
34 QList<CAmount> CoinControlDialog::payAmounts;
37 
38 bool CCoinControlWidgetItem::operator<(const QTreeWidgetItem &other) const {
39  int column = treeWidget()->sortColumn();
41  return data(column, Qt::UserRole).toLongLong() < other.data(column, Qt::UserRole).toLongLong();
42  return QTreeWidgetItem::operator<(other);
43 }
44 
45 CoinControlDialog::CoinControlDialog(QWidget* parent) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint),
46  ui(new Ui::CoinControlDialog),
47  model(0)
48 {
49  ui->setupUi(this);
50 
51  /* Open CSS when configured */
52  this->setStyleSheet(GUIUtil::loadStyleSheet());
53 
54  // context menu actions
55  QAction* copyAddressAction = new QAction(tr("Copy address"), this);
56  QAction* copyLabelAction = new QAction(tr("Copy label"), this);
57  QAction* copyAmountAction = new QAction(tr("Copy amount"), this);
58  copyTransactionHashAction = new QAction(tr("Copy transaction ID"), this); // we need to enable/disable this
59  lockAction = new QAction(tr("Lock unspent"), this); // we need to enable/disable this
60  unlockAction = new QAction(tr("Unlock unspent"), this); // we need to enable/disable this
61 
62  // context menu
63  contextMenu = new QMenu();
64  contextMenu->addAction(copyAddressAction);
65  contextMenu->addAction(copyLabelAction);
66  contextMenu->addAction(copyAmountAction);
68  contextMenu->addSeparator();
69  contextMenu->addAction(lockAction);
70  contextMenu->addAction(unlockAction);
71 
72  // context menu signals
73  connect(ui->treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint)));
74  connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress()));
75  connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel()));
76  connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount()));
77  connect(copyTransactionHashAction, SIGNAL(triggered()), this, SLOT(copyTransactionHash()));
78  connect(lockAction, SIGNAL(triggered()), this, SLOT(lockCoin()));
79  connect(unlockAction, SIGNAL(triggered()), this, SLOT(unlockCoin()));
80 
81  // clipboard actions
82  QAction* clipboardQuantityAction = new QAction(tr("Copy quantity"), this);
83  QAction* clipboardAmountAction = new QAction(tr("Copy amount"), this);
84  QAction* clipboardFeeAction = new QAction(tr("Copy fee"), this);
85  QAction* clipboardAfterFeeAction = new QAction(tr("Copy after fee"), this);
86  QAction* clipboardBytesAction = new QAction(tr("Copy bytes"), this);
87  QAction* clipboardPriorityAction = new QAction(tr("Copy priority"), this);
88  QAction* clipboardLowOutputAction = new QAction(tr("Copy dust"), this);
89  QAction* clipboardChangeAction = new QAction(tr("Copy change"), this);
90 
91  connect(clipboardQuantityAction, SIGNAL(triggered()), this, SLOT(clipboardQuantity()));
92  connect(clipboardAmountAction, SIGNAL(triggered()), this, SLOT(clipboardAmount()));
93  connect(clipboardFeeAction, SIGNAL(triggered()), this, SLOT(clipboardFee()));
94  connect(clipboardAfterFeeAction, SIGNAL(triggered()), this, SLOT(clipboardAfterFee()));
95  connect(clipboardBytesAction, SIGNAL(triggered()), this, SLOT(clipboardBytes()));
96  connect(clipboardPriorityAction, SIGNAL(triggered()), this, SLOT(clipboardPriority()));
97  connect(clipboardLowOutputAction, SIGNAL(triggered()), this, SLOT(clipboardLowOutput()));
98  connect(clipboardChangeAction, SIGNAL(triggered()), this, SLOT(clipboardChange()));
99 
100  ui->labelCoinControlQuantity->addAction(clipboardQuantityAction);
101  ui->labelCoinControlAmount->addAction(clipboardAmountAction);
102  ui->labelCoinControlFee->addAction(clipboardFeeAction);
103  ui->labelCoinControlAfterFee->addAction(clipboardAfterFeeAction);
104  ui->labelCoinControlBytes->addAction(clipboardBytesAction);
105  ui->labelCoinControlPriority->addAction(clipboardPriorityAction);
106  ui->labelCoinControlLowOutput->addAction(clipboardLowOutputAction);
107  ui->labelCoinControlChange->addAction(clipboardChangeAction);
108 
109  // toggle tree/list mode
110  connect(ui->radioTreeMode, SIGNAL(toggled(bool)), this, SLOT(radioTreeMode(bool)));
111  connect(ui->radioListMode, SIGNAL(toggled(bool)), this, SLOT(radioListMode(bool)));
112 
113  // click on checkbox
114  connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(viewItemChanged(QTreeWidgetItem*, int)));
115 
116  // click on header
117  ui->treeWidget->header()->setSectionsClickable(true);
118  connect(ui->treeWidget->header(), SIGNAL(sectionClicked(int)), this, SLOT(headerSectionClicked(int)));
119 
120  // ok button
121  connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(buttonBoxClicked(QAbstractButton*)));
122 
123  // (un)select all
124  connect(ui->pushButtonSelectAll, SIGNAL(clicked()), this, SLOT(buttonSelectAllClicked()));
125 
126  // Toggle lock state
127  connect(ui->pushButtonToggleLock, SIGNAL(clicked()), this, SLOT(buttonToggleLockClicked()));
128 
129  // change coin control first column label due Qt4 bug.
130  // see https://github.com/bitcoin/bitcoin/issues/5716
131  ui->treeWidget->headerItem()->setText(COLUMN_CHECKBOX, QString());
132 
133  ui->treeWidget->setColumnWidth(COLUMN_CHECKBOX, 84);
134  ui->treeWidget->setColumnWidth(COLUMN_AMOUNT, 100);
135  ui->treeWidget->setColumnWidth(COLUMN_LABEL, 170);
136  ui->treeWidget->setColumnWidth(COLUMN_ADDRESS, 190);
137  ui->treeWidget->setColumnWidth(COLUMN_DATE, 80);
138  ui->treeWidget->setColumnWidth(COLUMN_CONFIRMATIONS, 100);
139  ui->treeWidget->setColumnWidth(COLUMN_PRIORITY, 100);
140  ui->treeWidget->setColumnHidden(COLUMN_TXHASH, true); // store transacton hash in this column, but dont show it
141  ui->treeWidget->setColumnHidden(COLUMN_VOUT_INDEX, true); // store vout index in this column, but dont show it
142 
143  // default view is sorted by amount desc
144  sortView(COLUMN_AMOUNT, Qt::DescendingOrder);
145 
146  // restore list mode and sortorder as a convenience feature
147  QSettings settings;
148  if (settings.contains("nCoinControlMode") && !settings.value("nCoinControlMode").toBool())
149  ui->radioTreeMode->click();
150  if (settings.contains("nCoinControlSortColumn") && settings.contains("nCoinControlSortOrder"))
151  sortView(settings.value("nCoinControlSortColumn").toInt(), ((Qt::SortOrder)settings.value("nCoinControlSortOrder").toInt()));
152 }
153 
155 {
156  QSettings settings;
157  settings.setValue("nCoinControlMode", ui->radioListMode->isChecked());
158  settings.setValue("nCoinControlSortColumn", sortColumn);
159  settings.setValue("nCoinControlSortOrder", (int)sortOrder);
160 
161  delete ui;
162 }
163 
165 {
166  this->model = model;
167 
169  updateView();
173  }
174 }
175 
176 // ok button
177 void CoinControlDialog::buttonBoxClicked(QAbstractButton* button)
178 {
179  if (ui->buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole)
180  done(QDialog::Accepted); // closes the dialog
181 }
182 
183 // (un)select all
185 {
186  // "Select all": if some entry is unchecked, then check it
187  // "Unselect all": if some entry is checked, then uncheck it
188  Qt::CheckState wantedState = fSelectAllToggled ? Qt::Checked : Qt::Unchecked;
189  ui->treeWidget->setEnabled(false);
190  for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++)
191  if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) != wantedState)
192  ui->treeWidget->topLevelItem(i)->setCheckState(COLUMN_CHECKBOX, wantedState);
193  ui->treeWidget->setEnabled(true);
194  if (!fSelectAllToggled) {
195  coinControl->UnSelectAll(); // just to be sure
196  ui->pushButtonSelectAll->setText(tr("Select all"));
197  } else {
198  ui->pushButtonSelectAll->setText(tr("Unselect all"));
199  }
203 }
204 
205 // Toggle lock state
207 {
208  QTreeWidgetItem* item;
209  // Works in list-mode only
210  if (ui->radioListMode->isChecked()) {
211  ui->treeWidget->setEnabled(false);
212  for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++) {
213  item = ui->treeWidget->topLevelItem(i);
214 
215  if (item->text(COLUMN_TYPE) == "MultiSig")
216  continue;
217 
218  COutPoint outpt(uint256(item->text(COLUMN_TXHASH).toStdString()), item->text(COLUMN_VOUT_INDEX).toUInt());
219  if (model->isLockedCoin(uint256(item->text(COLUMN_TXHASH).toStdString()), item->text(COLUMN_VOUT_INDEX).toUInt())) {
220  model->unlockCoin(outpt);
221  item->setDisabled(false);
222  item->setIcon(COLUMN_CHECKBOX, QIcon());
223  } else {
224  model->lockCoin(outpt);
225  item->setDisabled(true);
226  item->setIcon(COLUMN_CHECKBOX, QIcon(":/icons/lock_closed"));
227  }
229  }
230  ui->treeWidget->setEnabled(true);
233  } else {
234  QMessageBox msgBox;
235  msgBox.setObjectName("lockMessageBox");
236  msgBox.setStyleSheet(GUIUtil::loadStyleSheet());
237  msgBox.setText(tr("Please switch to \"List mode\" to use this function."));
238  msgBox.exec();
239  }
240 }
241 
242 // context menu
243 void CoinControlDialog::showMenu(const QPoint& point)
244 {
245  QTreeWidgetItem* item = ui->treeWidget->itemAt(point);
246  if (item) {
247  contextMenuItem = item;
248 
249  // disable some items (like Copy Transaction ID, lock, unlock) for tree roots in context menu
250  if (item->text(COLUMN_TXHASH).length() == 64) // transaction hash is 64 characters (this means its a child node, so its not a parent node in tree mode)
251  {
252  copyTransactionHashAction->setEnabled(true);
253  if (model->isLockedCoin(uint256(item->text(COLUMN_TXHASH).toStdString()), item->text(COLUMN_VOUT_INDEX).toUInt())) {
254  lockAction->setEnabled(false);
255  unlockAction->setEnabled(true);
256  } else {
257  lockAction->setEnabled(true);
258  unlockAction->setEnabled(false);
259  }
260  } else // this means click on parent node in tree mode -> disable all
261  {
262  copyTransactionHashAction->setEnabled(false);
263  lockAction->setEnabled(false);
264  unlockAction->setEnabled(false);
265  }
266 
267  // show context menu
268  contextMenu->exec(QCursor::pos());
269  }
270 }
271 
272 // context menu action: copy amount
274 {
276 }
277 
278 // context menu action: copy label
280 {
281  if (ui->radioTreeMode->isChecked() && contextMenuItem->text(COLUMN_LABEL).length() == 0 && contextMenuItem->parent())
283  else
285 }
286 
287 // context menu action: copy address
289 {
290  if (ui->radioTreeMode->isChecked() && contextMenuItem->text(COLUMN_ADDRESS).length() == 0 && contextMenuItem->parent())
292  else
294 }
295 
296 // context menu action: copy transaction id
298 {
300 }
301 
302 // context menu action: lock coin
304 {
305  if (contextMenuItem->checkState(COLUMN_CHECKBOX) == Qt::Checked)
306  contextMenuItem->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
307 
308  COutPoint outpt(uint256(contextMenuItem->text(COLUMN_TXHASH).toStdString()), contextMenuItem->text(COLUMN_VOUT_INDEX).toUInt());
309  model->lockCoin(outpt);
310  contextMenuItem->setDisabled(true);
311  contextMenuItem->setIcon(COLUMN_CHECKBOX, QIcon(":/icons/lock_closed"));
313 }
314 
315 // context menu action: unlock coin
317 {
318  COutPoint outpt(uint256(contextMenuItem->text(COLUMN_TXHASH).toStdString()), contextMenuItem->text(COLUMN_VOUT_INDEX).toUInt());
319  model->unlockCoin(outpt);
320  contextMenuItem->setDisabled(false);
321  contextMenuItem->setIcon(COLUMN_CHECKBOX, QIcon());
323 }
324 
325 // copy label "Quantity" to clipboard
327 {
328  GUIUtil::setClipboard(ui->labelCoinControlQuantity->text());
329 }
330 
331 // copy label "Amount" to clipboard
333 {
334  GUIUtil::setClipboard(ui->labelCoinControlAmount->text().left(ui->labelCoinControlAmount->text().indexOf(" ")));
335 }
336 
337 // copy label "Fee" to clipboard
339 {
340  GUIUtil::setClipboard(ui->labelCoinControlFee->text().left(ui->labelCoinControlFee->text().indexOf(" ")).replace("~", ""));
341 }
342 
343 // copy label "After fee" to clipboard
345 {
346  GUIUtil::setClipboard(ui->labelCoinControlAfterFee->text().left(ui->labelCoinControlAfterFee->text().indexOf(" ")).replace("~", ""));
347 }
348 
349 // copy label "Bytes" to clipboard
351 {
352  GUIUtil::setClipboard(ui->labelCoinControlBytes->text().replace("~", ""));
353 }
354 
355 // copy label "Priority" to clipboard
357 {
358  GUIUtil::setClipboard(ui->labelCoinControlPriority->text());
359 }
360 
361 // copy label "Dust" to clipboard
363 {
364  GUIUtil::setClipboard(ui->labelCoinControlLowOutput->text());
365 }
366 
367 // copy label "Change" to clipboard
369 {
370  GUIUtil::setClipboard(ui->labelCoinControlChange->text().left(ui->labelCoinControlChange->text().indexOf(" ")).replace("~", ""));
371 }
372 
373 // treeview: sort
374 void CoinControlDialog::sortView(int column, Qt::SortOrder order)
375 {
376  sortColumn = column;
377  sortOrder = order;
378  ui->treeWidget->sortItems(column, order);
379  ui->treeWidget->header()->setSortIndicator(sortColumn, sortOrder);
380 }
381 
382 // treeview: clicked on header
384 {
385  if (logicalIndex == COLUMN_CHECKBOX) // click on most left column -> do nothing
386  {
387  ui->treeWidget->header()->setSortIndicator(sortColumn, sortOrder);
388  } else {
389  if (sortColumn == logicalIndex)
390  sortOrder = ((sortOrder == Qt::AscendingOrder) ? Qt::DescendingOrder : Qt::AscendingOrder);
391  else {
392  sortColumn = logicalIndex;
393  sortOrder = ((sortColumn == COLUMN_LABEL || sortColumn == COLUMN_ADDRESS) ? Qt::AscendingOrder : Qt::DescendingOrder); // if label or address then default => asc, else default => desc
394  }
395 
397  }
398 }
399 
400 // toggle tree mode
402 {
403  if (checked && model)
404  updateView();
405 }
406 
407 // toggle list mode
409 {
410  if (checked && model)
411  updateView();
412 }
413 
414 // checkbox clicked by user
415 void CoinControlDialog::viewItemChanged(QTreeWidgetItem* item, int column)
416 {
417  if (column == COLUMN_CHECKBOX && item->text(COLUMN_TXHASH).length() == 64) // transaction hash is 64 characters (this means its a child node, so its not a parent node in tree mode)
418  {
419  COutPoint outpt(uint256(item->text(COLUMN_TXHASH).toStdString()), item->text(COLUMN_VOUT_INDEX).toUInt());
420 
421  if (item->checkState(COLUMN_CHECKBOX) == Qt::Unchecked)
422  coinControl->UnSelect(outpt);
423  else if (item->isDisabled()) // locked (this happens if "check all" through parent node)
424  item->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
425  else
426  coinControl->Select(outpt);
427 
428  // selection changed -> update labels
429  if (ui->treeWidget->isEnabled()){ // do not update on every click for (un)select all
432  }
433  }
434 
435  // TODO: Remove this temporary qt5 fix after Qt5.3 and Qt5.4 are no longer used.
436  // Fixed in Qt5.5 and above: https://bugreports.qt.io/browse/QTBUG-43473
437  else if (column == COLUMN_CHECKBOX && item->childCount() > 0)
438  {
439  if (item->checkState(COLUMN_CHECKBOX) == Qt::PartiallyChecked && item->child(0)->checkState(COLUMN_CHECKBOX) == Qt::PartiallyChecked)
440  item->setCheckState(COLUMN_CHECKBOX, Qt::Checked);
441  }
442 }
443 
444 // return human readable label for priority number
445 QString CoinControlDialog::getPriorityLabel(double dPriority, double mempoolEstimatePriority)
446 {
447  double dPriorityMedium = mempoolEstimatePriority;
448 
449  if (dPriorityMedium <= 0)
450  dPriorityMedium = AllowFreeThreshold(); // not enough data, back to hard-coded
451 
452  if (dPriority / 1000000 > dPriorityMedium)
453  return tr("highest");
454  else if (dPriority / 100000 > dPriorityMedium)
455  return tr("higher");
456  else if (dPriority / 10000 > dPriorityMedium)
457  return tr("high");
458  else if (dPriority / 1000 > dPriorityMedium)
459  return tr("medium-high");
460  else if (dPriority > dPriorityMedium)
461  return tr("medium");
462  else if (dPriority * 10 > dPriorityMedium)
463  return tr("low-medium");
464  else if (dPriority * 100 > dPriorityMedium)
465  return tr("low");
466  else if (dPriority * 1000 > dPriorityMedium)
467  return tr("lower");
468  else
469  return tr("lowest");
470 }
471 
472 // shows count of locked unspent outputs
474 {
475  std::vector<COutPoint> vOutpts;
476  model->listLockedCoins(vOutpts);
477  if (vOutpts.size() > 0) {
478  ui->labelLocked->setText(tr("(%1 locked)").arg(vOutpts.size()));
479  ui->labelLocked->setVisible(true);
480  } else
481  ui->labelLocked->setVisible(false);
482 }
483 
485 {
486 
487  if (this->parentWidget() == nullptr) {
489  return;
490  }
491 
492  std::vector<COutPoint> vCoinControl;
493  std::vector<COutput> vOutputs;
494  coinControl->ListSelected(vCoinControl);
495  model->getOutputs(vCoinControl, vOutputs);
496 
497  CAmount nAmount = 0;
498  unsigned int nQuantity = 0;
499  for (const COutput& out : vOutputs) {
500  // unselect already spent, very unlikely scenario, this could happen
501  // when selected are spent elsewhere, like rpc or another computer
502  uint256 txhash = out.tx->GetHash();
503  COutPoint outpt(txhash, out.i);
504  if(model->isSpent(outpt)) {
505  coinControl->UnSelect(outpt);
506  continue;
507  }
508 
509  // Quantity
510  nQuantity++;
511 
512  // Amount
513  nAmount += model->getCWallet()->getCTxOutValue(*out.tx, out.tx->vout[out.i]);
514  }
515 }
516 
517 void CoinControlDialog::updateLabels(WalletModel* model, QDialog* dialog)
518 {
519  if (!model)
520  return;
521 
522  // nPayAmount
523  CAmount nPayAmount = 0;
524  bool fDust = false;
525  CMutableTransaction txDummy;
526  Q_FOREACH (const CAmount& amount, CoinControlDialog::payAmounts) {
527  nPayAmount += amount;
528 
529  if (amount > 0) {
530  CTxOut txout(amount, (CScript)std::vector<unsigned char>(24, 0));
531  txDummy.vout.push_back(txout);
532  if (txout.IsDust(::minRelayTxFee))
533  fDust = true;
534  }
535  }
536 
537  QString sPriorityLabel = tr("none");
538  CAmount nAmount = 0;
539  CAmount nPayFee = 0;
540  CAmount nAfterFee = 0;
541  CAmount nChange = 0;
542  unsigned int nBytes = 0;
543  unsigned int nBytesInputs = 0;
544  double dPriority = 0;
545  double dPriorityInputs = 0;
546  unsigned int nQuantity = 0;
547  int nQuantityUncompressed = 0;
548  bool fAllowFree = false;
549 
550  std::vector<COutPoint> vCoinControl;
551  std::vector<COutput> vOutputs;
552  coinControl->ListSelected(vCoinControl);
553  model->getOutputs(vCoinControl, vOutputs);
554 
555  for (const COutput& out : vOutputs) {
556  // unselect already spent, very unlikely scenario, this could happen
557  // when selected are spent elsewhere, like rpc or another computer
558  uint256 txhash = out.tx->GetHash();
559  COutPoint outpt(txhash, out.i);
560  if (model->isSpent(outpt)) {
561  coinControl->UnSelect(outpt);
562  continue;
563  }
564 
565  // Quantity
566  nQuantity++;
567 
568  // Amount
569  nAmount += model->getCWallet()->getCTxOutValue(*out.tx, out.tx->vout[out.i]);
570 
571  // Priority
572  dPriorityInputs += (double)(model->getCWallet()->getCTxOutValue(*out.tx, out.tx->vout[out.i])) * (out.nDepth + 1);
573 
574  // Bytes
575  CTxDestination address;
576  if (ExtractDestination(out.tx->vout[out.i].scriptPubKey, address)) {
577  CPubKey pubkey;
578  CKeyID* keyid = boost::get<CKeyID>(&address);
579  if (keyid && model->getPubKey(*keyid, pubkey)) {
580  nBytesInputs += (pubkey.IsCompressed() ? 148 : 180);
581  if (!pubkey.IsCompressed())
582  nQuantityUncompressed++;
583  } else
584  nBytesInputs += 148; // in all error cases, simply assume 148 here
585  } else
586  nBytesInputs += 148;
587  }
588 
589  // calculation
590  if (nQuantity > 0) {
591  // Bytes
592  nBytes = nBytesInputs + ((CoinControlDialog::payAmounts.size() > 0 ? CoinControlDialog::payAmounts.size() + std::max(1, CoinControlDialog::nSplitBlockDummy) : 2) * 34) + 10; // always assume +1 output for change here
593 
594  // Priority
595  double mempoolEstimatePriority = mempool.estimatePriority(nTxConfirmTarget);
596  dPriority = dPriorityInputs / (nBytes - nBytesInputs + (nQuantityUncompressed * 29)); // 29 = 180 - 151 (uncompressed public keys are over the limit. max 151 bytes of the input are ignored for priority)
597  sPriorityLabel = CoinControlDialog::getPriorityLabel(dPriority, mempoolEstimatePriority);
598 
599  // Fee
600  nPayFee = CWallet::GetMinimumFee(nBytes, nTxConfirmTarget, mempool);
601 
602  // IX Fee
603  if (coinControl->useSwiftTX) nPayFee = std::max(nPayFee, CENT);
604  // Allow free?
605  double dPriorityNeeded = mempoolEstimatePriority;
606  if (dPriorityNeeded <= 0)
607  dPriorityNeeded = AllowFreeThreshold(); // not enough data, back to hard-coded
608  fAllowFree = (dPriority >= dPriorityNeeded);
609 
611  if (fAllowFree && nBytes <= MAX_FREE_TRANSACTION_CREATE_SIZE)
612  nPayFee = 0;
613 
614  if (nPayAmount > 0) {
615  nChange = nAmount - nPayFee - nPayAmount;
616 
617  // Never create dust outputs; if we would, just add the dust to the fee.
618  if (nChange > 0 && nChange < CENT) {
619  CTxOut txout(nChange, (CScript)std::vector<unsigned char>(24, 0));
620  if (txout.IsDust(::minRelayTxFee)) {
621  nPayFee += nChange;
622  nChange = 0;
623  }
624  }
625 
626  if (nChange == 0)
627  nBytes -= 34;
628  }
629 
630  // after fee
631  nAfterFee = nAmount - nPayFee;
632  if (nAfterFee < 0)
633  nAfterFee = 0;
634  }
635 
636  // actually update labels
637  int nDisplayUnit = BitcoinUnits::PRCY;
638  if (model && model->getOptionsModel())
639  nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
640 
641  QLabel* l1 = dialog->findChild<QLabel*>("labelCoinControlQuantity");
642  QLabel* l2 = dialog->findChild<QLabel*>("labelCoinControlAmount");
643  QLabel* l3 = dialog->findChild<QLabel*>("labelCoinControlFee");
644  QLabel* l4 = dialog->findChild<QLabel*>("labelCoinControlAfterFee");
645  QLabel* l5 = dialog->findChild<QLabel*>("labelCoinControlBytes");
646  QLabel* l6 = dialog->findChild<QLabel*>("labelCoinControlPriority");
647  QLabel* l7 = dialog->findChild<QLabel*>("labelCoinControlLowOutput");
648  QLabel* l8 = dialog->findChild<QLabel*>("labelCoinControlChange");
649 
650  // enable/disable "dust" and "change"
651  dialog->findChild<QLabel*>("labelCoinControlLowOutputText")->setEnabled(nPayAmount > 0);
652  dialog->findChild<QLabel*>("labelCoinControlLowOutput")->setEnabled(nPayAmount > 0);
653  dialog->findChild<QLabel*>("labelCoinControlChangeText")->setEnabled(nPayAmount > 0);
654  dialog->findChild<QLabel*>("labelCoinControlChange")->setEnabled(nPayAmount > 0);
655 
656  // stats
657  l1->setText(QString::number(nQuantity)); // Quantity
658  l2->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nAmount)); // Amount
659  l3->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nPayFee)); // Fee
660  l4->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nAfterFee)); // After Fee
661  l5->setText(((nBytes > 0) ? "~" : "") + QString::number(nBytes)); // Bytes
662  l6->setText(sPriorityLabel); // Priority
663  l7->setText(fDust ? tr("yes") : tr("no")); // Dust
664  l8->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nChange)); // Change
665  if (nPayFee > 0 && !(payTxFee.GetFeePerK() > 0 && fPayAtLeastCustomFee && nBytes < 1000)) {
666  l3->setText("~" + l3->text());
667  l4->setText("~" + l4->text());
668  if (nChange > 0)
669  l8->setText("~" + l8->text());
670  }
671 
672  // turn labels "red"
673  l5->setStyleSheet((nBytes >= MAX_FREE_TRANSACTION_CREATE_SIZE) ? "color:red;" : ""); // Bytes >= 1000
674  l6->setStyleSheet((dPriority > 0 && !fAllowFree) ? "color:red;" : ""); // Priority < "medium"
675  l7->setStyleSheet((fDust) ? "color:red;" : ""); // Dust = "yes"
676 
677  // tool tips
678  QString toolTip1 = tr("This label turns red, if the transaction size is greater than 1000 bytes.") + "<br /><br />";
679  toolTip1 += tr("This means a fee of at least %1 per kB is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CWallet::minTxFee.GetFeePerK())) + "<br /><br />";
680  toolTip1 += tr("Can vary +/- 1 byte per input.");
681 
682  QString toolTip2 = tr("Transactions with higher priority are more likely to get included into a block.") + "<br /><br />";
683  toolTip2 += tr("This label turns red, if the priority is smaller than \"medium\".") + "<br /><br />";
684  toolTip2 += tr("This means a fee of at least %1 per kB is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CWallet::minTxFee.GetFeePerK()));
685 
686  QString toolTip3 = tr("This label turns red, if any recipient receives an amount smaller than %1.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, ::minRelayTxFee.GetFee(546)));
687 
688  // how many satoshis the estimated fee can vary per byte we guess wrong
689  double dFeeVary;
690  if (payTxFee.GetFeePerK() > 0)
691  dFeeVary = (double)std::max(CWallet::minTxFee.GetFeePerK(), payTxFee.GetFeePerK()) / 1000;
692  else
693  dFeeVary = (double)std::max(CWallet::minTxFee.GetFeePerK(), mempool.estimateFee(nTxConfirmTarget).GetFeePerK()) / 1000;
694  QString toolTip4 = tr("Can vary +/- %1 duff(s) per input.").arg(dFeeVary);
695 
696  l3->setToolTip(toolTip4);
697  l4->setToolTip(toolTip4);
698  l5->setToolTip(toolTip1);
699  l6->setToolTip(toolTip2);
700  l7->setToolTip(toolTip3);
701  l8->setToolTip(toolTip4);
702  dialog->findChild<QLabel*>("labelCoinControlFeeText")->setToolTip(l3->toolTip());
703  dialog->findChild<QLabel*>("labelCoinControlAfterFeeText")->setToolTip(l4->toolTip());
704  dialog->findChild<QLabel*>("labelCoinControlBytesText")->setToolTip(l5->toolTip());
705  dialog->findChild<QLabel*>("labelCoinControlPriorityText")->setToolTip(l6->toolTip());
706  dialog->findChild<QLabel*>("labelCoinControlLowOutputText")->setToolTip(l7->toolTip());
707  dialog->findChild<QLabel*>("labelCoinControlChangeText")->setToolTip(l8->toolTip());
708 
709  // Insufficient funds
710  QLabel* label = dialog->findChild<QLabel*>("labelCoinControlInsuffFunds");
711  if (label)
712  label->setVisible(nChange < 0);
713 }
714 
716 {
718  return;
719 
720  bool treeMode = ui->radioTreeMode->isChecked();
721 
722  ui->treeWidget->clear();
723  ui->treeWidget->setEnabled(false); // performance, otherwise updateLabels would be called for every checked checkbox
724  ui->treeWidget->setAlternatingRowColors(!treeMode);
725  QFlags<Qt::ItemFlag> flgCheckbox = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable;
726  QFlags<Qt::ItemFlag> flgTristate = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsTristate;
727 
728  int nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
729  double mempoolEstimatePriority = mempool.estimatePriority(nTxConfirmTarget);
730 
731  std::map<QString, std::vector<COutput>> mapCoins;
732  model->listCoins(mapCoins);
733 
734  for (PAIRTYPE(QString, std::vector<COutput>) coins : mapCoins) {
735  CCoinControlWidgetItem* itemWalletAddress = new CCoinControlWidgetItem();
736  itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
737  QString sWalletAddress = coins.first;
738  QString sWalletLabel = model->getAddressTableModel()->labelForAddress(sWalletAddress);
739  if (sWalletLabel.isEmpty())
740  sWalletLabel = tr("(no label)");
741 
742  if (treeMode) {
743  // wallet address
744  ui->treeWidget->addTopLevelItem(itemWalletAddress);
745 
746  itemWalletAddress->setFlags(flgTristate);
747  itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
748 
749  // label
750  itemWalletAddress->setText(COLUMN_LABEL, sWalletLabel);
751  itemWalletAddress->setToolTip(COLUMN_LABEL, sWalletLabel);
752 
753  // address
754  itemWalletAddress->setText(COLUMN_ADDRESS, sWalletAddress);
755  itemWalletAddress->setToolTip(COLUMN_ADDRESS, sWalletAddress);
756  }
757 
758  CAmount nSum = 0;
759  double dPrioritySum = 0;
760  int nChildren = 0;
761  int nInputSum = 0;
762  for(const COutput& out: coins.second) {
763  isminetype mine = pwalletMain->IsMine(out.tx->vout[out.i]);
764  int nInputSize = 0;
765  nSum += model->getCWallet()->getCTxOutValue(*out.tx, out.tx->vout[out.i]);
766  nChildren++;
767 
768  CCoinControlWidgetItem* itemOutput;
769  if (treeMode)
770  itemOutput = new CCoinControlWidgetItem(itemWalletAddress);
771  else
772  itemOutput = new CCoinControlWidgetItem(ui->treeWidget);
773  itemOutput->setFlags(flgCheckbox);
774  itemOutput->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
775 
776  // address
777  CTxDestination outputAddress;
778  QString sAddress = "";
779  if (ExtractDestination(out.tx->vout[out.i].scriptPubKey, outputAddress)) {
780  sAddress = QString::fromStdString(CBitcoinAddress(outputAddress).ToString());
781 
782  // if listMode or change => show PRCY address. In tree mode, address is not shown again for direct wallet address outputs
783  if (!treeMode || (!(sAddress == sWalletAddress)))
784  itemOutput->setText(COLUMN_ADDRESS, sAddress);
785 
786  itemOutput->setToolTip(COLUMN_ADDRESS, sAddress);
787 
788  CPubKey pubkey;
789  CKeyID* keyid = boost::get<CKeyID>(&outputAddress);
790  if (keyid && model->getPubKey(*keyid, pubkey) && !pubkey.IsCompressed())
791  nInputSize = 29; // 29 = 180 - 151 (public key is 180 bytes, priority free area is 151 bytes)
792  }
793 
794  // label
795  if (!(sAddress == sWalletAddress)) // change
796  {
797  // tooltip from where the change comes from
798  itemOutput->setToolTip(COLUMN_LABEL, tr("change from %1 (%2)").arg(sWalletLabel).arg(sWalletAddress));
799  itemOutput->setText(COLUMN_LABEL, tr("(change)"));
800  } else if (!treeMode) {
801  QString sLabel = model->getAddressTableModel()->labelForAddress(sAddress);
802  if (sLabel.isEmpty())
803  sLabel = tr("(no label)");
804  itemOutput->setText(COLUMN_LABEL, sLabel);
805  }
806 
807  // amount
808  itemOutput->setText(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, model->getCWallet()->getCTxOutValue(*out.tx, out.tx->vout[out.i])));
809  itemOutput->setToolTip(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, model->getCWallet()->getCTxOutValue(*out.tx, out.tx->vout[out.i])));
810  itemOutput->setData(COLUMN_AMOUNT, Qt::UserRole, QVariant((qlonglong) model->getCWallet()->getCTxOutValue(*out.tx, out.tx->vout[out.i]))); // padding so that sorting works correctly
811 
812  // date
813  itemOutput->setText(COLUMN_DATE, GUIUtil::dateTimeStr(out.tx->GetTxTime()));
814  itemOutput->setToolTip(COLUMN_DATE, GUIUtil::dateTimeStr(out.tx->GetTxTime()));
815  itemOutput->setData(COLUMN_DATE, Qt::UserRole, QVariant((qlonglong) out.tx->GetTxTime()));
816 
817  // confirmations
818  itemOutput->setText(COLUMN_CONFIRMATIONS, QString::number(out.nDepth));
819  itemOutput->setData(COLUMN_CONFIRMATIONS, Qt::UserRole, QVariant((qlonglong) out.nDepth));
820 
821  // priority
822  double dPriority = ((double)(model->getCWallet()->getCTxOutValue(*out.tx, out.tx->vout[out.i])) / (nInputSize + 78)) * (out.nDepth + 1); // 78 = 2 * 34 + 10
823  itemOutput->setText(COLUMN_PRIORITY, CoinControlDialog::getPriorityLabel(dPriority, mempoolEstimatePriority));
824  itemOutput->setData(COLUMN_PRIORITY, Qt::UserRole, QVariant((qlonglong) dPriority));
825  dPrioritySum += (double)(model->getCWallet()->getCTxOutValue(*out.tx, out.tx->vout[out.i])) * (out.nDepth + 1);
826  nInputSum += nInputSize;
827 
828  // transaction hash
829  uint256 txhash = out.tx->GetHash();
830  itemOutput->setText(COLUMN_TXHASH, QString::fromStdString(txhash.GetHex()));
831 
832  // vout index
833  itemOutput->setText(COLUMN_VOUT_INDEX, QString::number(out.i));
834 
835  // disable locked coins
836  if (model->isLockedCoin(txhash, out.i)) {
837  COutPoint outpt(txhash, out.i);
838  coinControl->UnSelect(outpt); // just to be sure
839  itemOutput->setDisabled(true);
840  itemOutput->setIcon(COLUMN_CHECKBOX, QIcon(":/icons/lock_closed"));
841  }
842 
843  // set checkbox
844  if (coinControl->IsSelected(txhash, out.i))
845  itemOutput->setCheckState(COLUMN_CHECKBOX, Qt::Checked);
846  }
847 
848  // amount
849  if (treeMode) {
850  dPrioritySum = dPrioritySum / (nInputSum + 78);
851  itemWalletAddress->setText(COLUMN_CHECKBOX, "(" + QString::number(nChildren) + ")");
852  itemWalletAddress->setText(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, nSum));
853  itemWalletAddress->setToolTip(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, nSum));
854  itemWalletAddress->setData(COLUMN_AMOUNT, Qt::UserRole, QVariant((qlonglong) nSum));
855  itemWalletAddress->setText(COLUMN_PRIORITY, CoinControlDialog::getPriorityLabel(dPrioritySum, mempoolEstimatePriority));
856  itemWalletAddress->setData(COLUMN_PRIORITY, Qt::UserRole, QVariant((qlonglong) dPrioritySum));
857  }
858  }
859 
860  // expand all partially selected
861  if (treeMode) {
862  for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++)
863  if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) == Qt::PartiallyChecked)
864  ui->treeWidget->topLevelItem(i)->setExpanded(true);
865  }
866 
867  // sort view
869  ui->treeWidget->setEnabled(true);
870 }
CoinControlDialog::unlockAction
QAction * unlockAction
Definition: coincontroldialog.h:70
CCoinControl::Select
void Select(const COutPoint &output)
Definition: coincontrol.h:59
CCoinControl::IsSelected
bool IsSelected(const uint256 &hash, unsigned int n) const
Definition: coincontrol.h:53
WalletModel::getOptionsModel
OptionsModel * getOptionsModel()
Definition: walletmodel.cpp:358
CoinControlDialog::lockCoin
void lockCoin()
Definition: coincontroldialog.cpp:303
CoinControlDialog::COLUMN_DATE
@ COLUMN_DATE
Definition: coincontroldialog.h:80
CWallet::minTxFee
static CFeeRate minTxFee
Fees smaller than this (in duffs) are considered zero fee (for transaction creation) We are ~100 time...
Definition: wallet.h:536
WalletModel::listLockedCoins
void listLockedCoins(std::vector< COutPoint > &vOutpts)
Definition: walletmodel.cpp:668
minRelayTxFee
CFeeRate minRelayTxFee
Fees smaller than this (in duffs) are considered zero fee (for relaying and mining) We are ~100 times...
Definition: main.cpp:100
CoinControlDialog::COLUMN_TXHASH
@ COLUMN_TXHASH
Definition: coincontroldialog.h:83
CoinControlDialog::payAmounts
static QList< CAmount > payAmounts
Definition: coincontroldialog.h:55
CoinControlDialog::viewItemChanged
void viewItemChanged(QTreeWidgetItem *, int)
Definition: coincontroldialog.cpp:415
WalletModel
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:102
CoinControlDialog::showMenu
void showMenu(const QPoint &)
Definition: coincontroldialog.cpp:243
BitcoinUnits::formatWithUnit
static QString formatWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as string (with unit)
Definition: bitcoinunits.cpp:190
CWallet::IsMine
isminetype IsMine(const CTxIn &txin) const
Definition: wallet.cpp:1333
base_uint::GetHex
std::string GetHex() const
Definition: arith_uint256.cpp:155
CCoinControl::ListSelected
void ListSelected(std::vector< COutPoint > &vOutpoints)
Definition: coincontrol.h:74
CoinControlDialog::COLUMN_VOUT_INDEX
@ COLUMN_VOUT_INDEX
Definition: coincontroldialog.h:84
walletmodel.h
CoinControlDialog::setModel
void setModel(WalletModel *model)
Definition: coincontroldialog.cpp:164
CBitcoinAddress
base58-encoded PRCY addresses.
Definition: base58.h:109
CoinControlDialog::updateView
void updateView()
Definition: coincontroldialog.cpp:715
WalletModel::getAddressTableModel
AddressTableModel * getAddressTableModel()
Definition: walletmodel.cpp:363
AddressTableModel::labelForAddress
QString labelForAddress(const QString &address) const
Definition: addresstablemodel.cpp:400
CoinControlDialog::COLUMN_PRIORITY
@ COLUMN_PRIORITY
Definition: coincontroldialog.h:82
CCoinControl
Coin Control Features.
Definition: coincontrol.h:15
CoinControlDialog
Definition: coincontroldialog.h:39
wallet.h
fSendFreeTransactions
bool fSendFreeTransactions
Definition: wallet.cpp:56
CoinControlDialog::COLUMN_CHECKBOX
@ COLUMN_CHECKBOX
Definition: coincontroldialog.h:75
CoinControlDialog::sortColumn
int sortColumn
Definition: coincontroldialog.h:62
CTxOut::IsDust
bool IsDust(CFeeRate minRelayTxFee) const
Definition: transaction.h:227
CoinControlDialog::nSplitBlockDummy
static int nSplitBlockDummy
Definition: coincontroldialog.h:57
CCoinControlWidgetItem::operator<
bool operator<(const QTreeWidgetItem &other) const
Definition: coincontroldialog.cpp:38
CoinControlDialog::clipboardChange
void clipboardChange()
Definition: coincontroldialog.cpp:368
isminetype
isminetype
IsMine() return codes.
Definition: wallet_ismine.h:16
CWallet::GetMinimumFee
static CAmount GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool &pool)
Definition: wallet.cpp:4522
CKeyID
A reference to a CKey: the Hash160 of its serialized public key.
Definition: pubkey.h:29
WalletModel::getPubKey
bool getPubKey(const CKeyID &address, CPubKey &vchPubKeyOut) const
Definition: walletmodel.cpp:586
fPayAtLeastCustomFee
bool fPayAtLeastCustomFee
Definition: wallet.cpp:57
CoinControlDialog::radioListMode
void radioListMode(bool)
Definition: coincontroldialog.cpp:408
CoinControlDialog::model
WalletModel * model
Definition: coincontroldialog.h:61
CoinControlDialog::headerSectionClicked
void headerSectionClicked(int)
Definition: coincontroldialog.cpp:383
payTxFee
CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE)
Transaction fee set by the user.
CoinControlDialog::clipboardLowOutput
void clipboardLowOutput()
Definition: coincontroldialog.cpp:362
CoinControlDialog::fSelectAllToggled
bool fSelectAllToggled
Definition: coincontroldialog.h:64
GUIUtil::setClipboard
void setClipboard(const QString &str)
Definition: guiutil.cpp:785
OptionsModel::getDisplayUnit
int getDisplayUnit()
Definition: optionsmodel.h:60
CoinControlDialog::copyTransactionHashAction
QAction * copyTransactionHashAction
Definition: coincontroldialog.h:68
CoinControlDialog::copyLabel
void copyLabel()
Definition: coincontroldialog.cpp:279
CoinControlDialog::buttonSelectAllClicked
void buttonSelectAllClicked()
Definition: coincontroldialog.cpp:184
BitcoinUnits::removeSpaces
static QString removeSpaces(QString text)
Definition: bitcoinunits.h:116
operator<
bool operator<(const CBigNum &a, const CBigNum &b)
Definition: bignum.h:797
CoinControlDialog::sortView
void sortView(int, Qt::SortOrder)
Definition: coincontroldialog.cpp:374
nTxConfirmTarget
unsigned int nTxConfirmTarget
Definition: wallet.cpp:53
WalletModel::lockCoin
void lockCoin(COutPoint &output)
Definition: walletmodel.cpp:656
CoinControlDialog::copyTransactionHash
void copyTransactionHash()
Definition: coincontroldialog.cpp:297
CTxOut
An output of a transaction.
Definition: transaction.h:164
BitcoinUnits::PRCY
@ PRCY
Definition: bitcoinunits.h:61
init.h
CTransaction::vout
std::vector< CTxOut > vout
Definition: transaction.h:286
CoinControlDialog::contextMenuItem
QTreeWidgetItem * contextMenuItem
Definition: coincontroldialog.h:67
CoinControlDialog::clipboardAmount
void clipboardAmount()
Definition: coincontroldialog.cpp:332
CoinControlDialog::buttonBoxClicked
void buttonBoxClicked(QAbstractButton *)
Definition: coincontroldialog.cpp:177
CoinControlDialog::clipboardAfterFee
void clipboardAfterFee()
Definition: coincontroldialog.cpp:344
WalletModel::getCWallet
CWallet * getCWallet()
Definition: walletmodel.cpp:574
CoinControlDialog::clipboardBytes
void clipboardBytes()
Definition: coincontroldialog.cpp:350
CoinControlDialog::~CoinControlDialog
~CoinControlDialog()
Definition: coincontroldialog.cpp:154
CoinControlDialog::updateLabelLocked
void updateLabelLocked()
Definition: coincontroldialog.cpp:473
WalletModel::isLockedCoin
bool isLockedCoin(uint256 hash, unsigned int n) const
Definition: walletmodel.cpp:650
CCoinControl::UnSelectAll
void UnSelectAll()
Definition: coincontrol.h:69
PAIRTYPE
#define PAIRTYPE(t1, t2)
This is needed because the foreach macro can't get over the comma in pair<t1, t2>
Definition: utilstrencodings.h:24
CAmount
int64_t CAmount
Amount in PRCY (Can be negative)
Definition: amount.h:17
CoinControlDialog::COLUMN_AMOUNT
@ COLUMN_AMOUNT
Definition: coincontroldialog.h:76
mempool
CTxMemPool mempool(::minRelayTxFee)
guiutil.h
uint256
256-bit unsigned big integer.
Definition: uint256.h:38
uint256::GetHash
uint64_t GetHash(const uint256 &salt) const
Definition: uint256.cpp:99
AllowFreeThreshold
double AllowFreeThreshold()
Definition: txmempool.h:21
CWalletTx::GetTxTime
int64_t GetTxTime() const
Definition: wallet.cpp:1433
CScript
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:363
CoinControlDialog::updateLabels
static void updateLabels(WalletModel *, QDialog *)
Definition: coincontroldialog.cpp:517
ExtractDestination
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Definition: standard.cpp:199
CoinControlDialog::lockAction
QAction * lockAction
Definition: coincontroldialog.h:69
COutput::nDepth
int nDepth
Definition: wallet.h:927
WalletModel::isSpent
bool isSpent(const COutPoint &outpoint) const
Definition: walletmodel.cpp:609
CTxDestination
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:81
BitcoinUnits::format
static QString format(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as string.
Definition: bitcoinunits.cpp:140
CoinControlDialog::unlockCoin
void unlockCoin()
Definition: coincontroldialog.cpp:316
CoinControlDialog::CCoinControlWidgetItem
friend class CCoinControlWidgetItem
Definition: coincontroldialog.h:87
CPubKey::IsCompressed
bool IsCompressed() const
Check whether this is a compressed public key.
Definition: pubkey.h:168
COutput::tx
const CWalletTx * tx
Definition: wallet.h:925
CMutableTransaction::vout
std::vector< CTxOut > vout
Definition: transaction.h:388
CoinControlDialog::ui
Ui::CoinControlDialog * ui
Definition: coincontroldialog.h:60
CoinControlDialog::clipboardPriority
void clipboardPriority()
Definition: coincontroldialog.cpp:356
CPubKey
An encapsulated public key.
Definition: pubkey.h:37
CCoinControlWidgetItem
Definition: coincontroldialog.h:29
Ui
Definition: 2faconfirmdialog.h:7
WalletModel::listCoins
void listCoins(std::map< QString, std::vector< COutput > > &mapCoins) const
Definition: walletmodel.cpp:616
CoinControlDialog::clipboardQuantity
void clipboardQuantity()
Definition: coincontroldialog.cpp:326
WalletModel::unlockCoin
void unlockCoin(COutPoint &output)
Definition: walletmodel.cpp:662
CoinControlDialog::COLUMN_TYPE
@ COLUMN_TYPE
Definition: coincontroldialog.h:79
WalletModel::getOutputs
void getOutputs(const std::vector< COutPoint > &vOutpoints, std::vector< COutput > &vOutputs)
Definition: walletmodel.cpp:597
CoinControlDialog::coinControl
static CCoinControl * coinControl
Definition: coincontroldialog.h:56
CoinControlDialog::COLUMN_CONFIRMATIONS
@ COLUMN_CONFIRMATIONS
Definition: coincontroldialog.h:81
CoinControlDialog::COLUMN_ADDRESS
@ COLUMN_ADDRESS
Definition: coincontroldialog.h:78
main.h
CTxMemPool::estimateFee
CFeeRate estimateFee(int nBlocks) const
Estimate fee rate needed to get into the next nBlocks.
Definition: txmempool.cpp:633
CoinControlDialog::buttonToggleLockClicked
void buttonToggleLockClicked()
Definition: coincontroldialog.cpp:206
CoinControlDialog::radioTreeMode
void radioTreeMode(bool)
Definition: coincontroldialog.cpp:401
CoinControlDialog::contextMenu
QMenu * contextMenu
Definition: coincontroldialog.h:66
coincontroldialog.h
bitcoinunits.h
CoinControlDialog::copyAddress
void copyAddress()
Definition: coincontroldialog.cpp:288
CoinControlDialog::updateDialogLabels
void updateDialogLabels()
Definition: coincontroldialog.cpp:484
CCoinControl::useSwiftTX
bool useSwiftTX
Definition: coincontrol.h:21
CoinControlDialog::COLUMN_LABEL
@ COLUMN_LABEL
Definition: coincontroldialog.h:77
GUIUtil::dateTimeStr
QString dateTimeStr(const QDateTime &date)
Definition: guiutil.cpp:70
CoinControlDialog::copyAmount
void copyAmount()
Definition: coincontroldialog.cpp:273
CTransaction::GetHash
const uint256 & GetHash() const
Definition: transaction.h:342
COutput::i
int i
Definition: wallet.h:926
COutPoint
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:36
optionsmodel.h
CMutableTransaction
A mutable version of CTransaction.
Definition: transaction.h:384
coincontrol.h
CFeeRate::GetFee
CAmount GetFee(size_t size) const
Definition: amount.cpp:20
GUIUtil::loadStyleSheet
QString loadStyleSheet()
Load global CSS theme.
Definition: guiutil.cpp:721
CoinControlDialog::sortOrder
Qt::SortOrder sortOrder
Definition: coincontroldialog.h:63
CFeeRate::GetFeePerK
CAmount GetFeePerK() const
Definition: amount.h:50
CoinControlDialog::clipboardFee
void clipboardFee()
Definition: coincontroldialog.cpp:338
pwalletMain
CWallet * pwalletMain
Definition: wallet.cpp:49
COutput
Definition: wallet.h:922
CoinControlDialog::CoinControlDialog
CoinControlDialog(QWidget *parent=nullptr)
Definition: coincontroldialog.cpp:45
addresstablemodel.h
CoinControlDialog::getPriorityLabel
static QString getPriorityLabel(double dPriority, double mempoolEstimatePriority)
Definition: coincontroldialog.cpp:445
CTxMemPool::estimatePriority
double estimatePriority(int nBlocks) const
Estimate priority needed to get into the next nBlocks.
Definition: txmempool.cpp:638
CCoinControl::UnSelect
void UnSelect(const COutPoint &output)
Definition: coincontrol.h:64
CWallet::getCTxOutValue
CAmount getCTxOutValue(const CTransaction &tx, const CTxOut &out) const
Definition: wallet.cpp:7202