mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
[BROKEN] Unbreak Qt code after CA
This commit is contained in:
parent
f7920d77ec
commit
5f9f578ee6
11 changed files with 71 additions and 59 deletions
|
|
@ -419,7 +419,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
|
|||
|
||||
if (amount > 0)
|
||||
{
|
||||
CTxOut txout(amount, static_cast<CScript>(std::vector<unsigned char>(24, 0)));
|
||||
CTxOut txout(::policyAsset, amount, static_cast<CScript>(std::vector<unsigned char>(24, 0)));
|
||||
txDummy.vout.push_back(txout);
|
||||
fDust |= IsDust(txout, model->node().getDustRelayFee());
|
||||
}
|
||||
|
|
@ -454,7 +454,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
|
|||
nQuantity++;
|
||||
|
||||
// Amount
|
||||
nAmount += out.txout.nValue;
|
||||
nAmount += out.txout.nValue.GetAmount();
|
||||
|
||||
// Bytes
|
||||
CTxDestination address;
|
||||
|
|
@ -468,8 +468,8 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
|
|||
else if(ExtractDestination(out.txout.scriptPubKey, address))
|
||||
{
|
||||
CPubKey pubkey;
|
||||
CKeyID *keyid = boost::get<CKeyID>(&address);
|
||||
if (keyid && model->wallet().getPubKey(*keyid, pubkey))
|
||||
PKHash *keyid = boost::get<PKHash>(&address);
|
||||
if (keyid && model->wallet().getPubKey(CKeyID(*keyid), pubkey))
|
||||
{
|
||||
nBytesInputs += (pubkey.IsCompressed() ? 148 : 180);
|
||||
}
|
||||
|
|
@ -510,7 +510,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
|
|||
// Never create dust outputs; if we would, just add the dust to the fee.
|
||||
if (nChange > 0 && nChange < MIN_CHANGE)
|
||||
{
|
||||
CTxOut txout(nChange, static_cast<CScript>(std::vector<unsigned char>(24, 0)));
|
||||
CTxOut txout(::policyAsset, nChange, static_cast<CScript>(std::vector<unsigned char>(24, 0)));
|
||||
if (IsDust(txout, model->node().getDustRelayFee()))
|
||||
{
|
||||
nPayFee += nChange;
|
||||
|
|
@ -639,7 +639,7 @@ void CoinControlDialog::updateView()
|
|||
for (const auto& outpair : coins.second) {
|
||||
const COutPoint& output = std::get<0>(outpair);
|
||||
const interfaces::WalletTxOut& out = std::get<1>(outpair);
|
||||
nSum += out.txout.nValue;
|
||||
nSum += out.txout.nValue.GetAmount();
|
||||
nChildren++;
|
||||
|
||||
CCoinControlWidgetItem *itemOutput;
|
||||
|
|
@ -676,8 +676,8 @@ void CoinControlDialog::updateView()
|
|||
}
|
||||
|
||||
// amount
|
||||
itemOutput->setText(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, out.txout.nValue));
|
||||
itemOutput->setData(COLUMN_AMOUNT, Qt::UserRole, QVariant((qlonglong)out.txout.nValue)); // padding so that sorting works correctly
|
||||
itemOutput->setText(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, out.txout.nValue.GetAmount()));
|
||||
itemOutput->setData(COLUMN_AMOUNT, Qt::UserRole, QVariant((qlonglong)out.txout.nValue.GetAmount())); // padding so that sorting works correctly
|
||||
|
||||
// date
|
||||
itemOutput->setText(COLUMN_DATE, GUIUtil::dateTimeStr(out.time));
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <qt/qvalidatedlineedit.h>
|
||||
#include <qt/walletmodel.h>
|
||||
|
||||
#include <asset.h>
|
||||
#include <base58.h>
|
||||
#include <chainparams.h>
|
||||
#include <primitives/transaction.h>
|
||||
|
|
@ -211,7 +212,7 @@ bool isDust(interfaces::Node& node, const QString& address, const CAmount& amoun
|
|||
{
|
||||
CTxDestination dest = DecodeDestination(address.toStdString());
|
||||
CScript script = GetScriptForDestination(dest);
|
||||
CTxOut txOut(amount, script);
|
||||
CTxOut txOut(CAsset(), amount, script);
|
||||
return IsDust(txOut, node.getDustRelayFee());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@
|
|||
#include <qt/transactiontablemodel.h>
|
||||
#include <qt/walletmodel.h>
|
||||
|
||||
#include <policy/policy.h>
|
||||
|
||||
#include <QAbstractItemDelegate>
|
||||
#include <QPainter>
|
||||
|
||||
|
|
@ -119,7 +121,7 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent)
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
m_balances.balance = -1;
|
||||
m_balances.balance[::policyAsset] = -1;
|
||||
|
||||
// use a SingleColorIcon for the "out of sync warning" icon
|
||||
QIcon icon = platformStyle->SingleColorIcon(":/icons/warning");
|
||||
|
|
@ -161,19 +163,19 @@ void OverviewPage::setBalance(const interfaces::WalletBalances& balances)
|
|||
{
|
||||
int unit = walletModel->getOptionsModel()->getDisplayUnit();
|
||||
m_balances = balances;
|
||||
ui->labelBalance->setText(BitcoinUnits::formatWithUnit(unit, balances.balance, false, BitcoinUnits::separatorAlways));
|
||||
ui->labelUnconfirmed->setText(BitcoinUnits::formatWithUnit(unit, balances.unconfirmed_balance, false, BitcoinUnits::separatorAlways));
|
||||
ui->labelImmature->setText(BitcoinUnits::formatWithUnit(unit, balances.immature_balance, false, BitcoinUnits::separatorAlways));
|
||||
ui->labelTotal->setText(BitcoinUnits::formatWithUnit(unit, balances.balance + balances.unconfirmed_balance + balances.immature_balance, false, BitcoinUnits::separatorAlways));
|
||||
ui->labelWatchAvailable->setText(BitcoinUnits::formatWithUnit(unit, balances.watch_only_balance, false, BitcoinUnits::separatorAlways));
|
||||
ui->labelWatchPending->setText(BitcoinUnits::formatWithUnit(unit, balances.unconfirmed_watch_only_balance, false, BitcoinUnits::separatorAlways));
|
||||
ui->labelWatchImmature->setText(BitcoinUnits::formatWithUnit(unit, balances.immature_watch_only_balance, false, BitcoinUnits::separatorAlways));
|
||||
ui->labelWatchTotal->setText(BitcoinUnits::formatWithUnit(unit, balances.watch_only_balance + balances.unconfirmed_watch_only_balance + balances.immature_watch_only_balance, false, BitcoinUnits::separatorAlways));
|
||||
ui->labelBalance->setText(BitcoinUnits::formatWithUnit(unit, valueFor(balances.balance, ::policyAsset), false, BitcoinUnits::separatorAlways));
|
||||
ui->labelUnconfirmed->setText(BitcoinUnits::formatWithUnit(unit, valueFor(balances.unconfirmed_balance, ::policyAsset), false, BitcoinUnits::separatorAlways));
|
||||
ui->labelImmature->setText(BitcoinUnits::formatWithUnit(unit, valueFor(balances.immature_balance, ::policyAsset), false, BitcoinUnits::separatorAlways));
|
||||
ui->labelTotal->setText(BitcoinUnits::formatWithUnit(unit, valueFor(balances.balance, ::policyAsset) + valueFor(balances.unconfirmed_balance, ::policyAsset) + valueFor(balances.immature_balance, ::policyAsset), false, BitcoinUnits::separatorAlways));
|
||||
ui->labelWatchAvailable->setText(BitcoinUnits::formatWithUnit(unit, valueFor(balances.watch_only_balance, ::policyAsset), false, BitcoinUnits::separatorAlways));
|
||||
ui->labelWatchPending->setText(BitcoinUnits::formatWithUnit(unit, valueFor(balances.unconfirmed_watch_only_balance, ::policyAsset), false, BitcoinUnits::separatorAlways));
|
||||
ui->labelWatchImmature->setText(BitcoinUnits::formatWithUnit(unit, valueFor(balances.immature_watch_only_balance, ::policyAsset), false, BitcoinUnits::separatorAlways));
|
||||
ui->labelWatchTotal->setText(BitcoinUnits::formatWithUnit(unit, valueFor(balances.watch_only_balance, ::policyAsset) + valueFor(balances.unconfirmed_watch_only_balance, ::policyAsset) + valueFor(balances.immature_watch_only_balance, ::policyAsset), false, BitcoinUnits::separatorAlways));
|
||||
|
||||
// only show immature (newly mined) balance if it's non-zero, so as not to complicate things
|
||||
// for the non-mining users
|
||||
bool showImmature = balances.immature_balance != 0;
|
||||
bool showWatchOnlyImmature = balances.immature_watch_only_balance != 0;
|
||||
bool showImmature = valueFor(balances.immature_balance, ::policyAsset) != 0;
|
||||
bool showWatchOnlyImmature = valueFor(balances.immature_watch_only_balance, ::policyAsset) != 0;
|
||||
|
||||
// for symmetry reasons also show immature label when the watch-only one is shown
|
||||
ui->labelImmature->setVisible(showImmature || showWatchOnlyImmature);
|
||||
|
|
@ -243,7 +245,7 @@ void OverviewPage::updateDisplayUnit()
|
|||
{
|
||||
if(walletModel && walletModel->getOptionsModel())
|
||||
{
|
||||
if (m_balances.balance != -1) {
|
||||
if (m_balances.balance[::policyAsset] != -1) {
|
||||
setBalance(m_balances);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -566,7 +566,7 @@ bool PaymentServer::processPaymentRequest(const PaymentRequestPlus& request, Sen
|
|||
}
|
||||
|
||||
// Extract and check amounts
|
||||
CTxOut txOut(sendingTo.second, sendingTo.first);
|
||||
CTxOut txOut(::policyAsset, sendingTo.second, sendingTo.first);
|
||||
if (IsDust(txOut, optionsModel->node().getDustRelayFee())) {
|
||||
Q_EMIT message(tr("Payment request error"), tr("Requested payment amount of %1 is too small (considered dust).")
|
||||
.arg(BitcoinUnits::formatWithUnit(optionsModel->getDisplayUnit(), sendingTo.second)),
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include <ui_interface.h>
|
||||
#include <txmempool.h>
|
||||
#include <policy/fees.h>
|
||||
#include <policy/policy.h>
|
||||
#include <wallet/fees.h>
|
||||
|
||||
#include <QFontMetrics>
|
||||
|
|
@ -526,7 +527,7 @@ void SendCoinsDialog::setBalance(const interfaces::WalletBalances& balances)
|
|||
{
|
||||
if(model && model->getOptionsModel())
|
||||
{
|
||||
ui->labelBalance->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), balances.balance));
|
||||
ui->labelBalance->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), valueFor(balances.balance, ::policyAsset)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -618,7 +619,7 @@ void SendCoinsDialog::useAvailableBalance(SendCoinsEntry* entry)
|
|||
}
|
||||
|
||||
// Calculate available amount to send.
|
||||
CAmount amount = model->wallet().getAvailableBalance(coin_control);
|
||||
CAmount amount = valueFor(model->wallet().getAvailableBalance(coin_control), ::policyAsset);
|
||||
for (int i = 0; i < ui->entries->count(); ++i) {
|
||||
SendCoinsEntry* e = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
|
||||
if (e && !e->isHidden() && e != entry) {
|
||||
|
|
@ -784,7 +785,8 @@ void SendCoinsDialog::coinControlChangeChecked(int state)
|
|||
{
|
||||
if (state == Qt::Unchecked)
|
||||
{
|
||||
CoinControlDialog::coinControl()->destChange = CNoDestination();
|
||||
// ELEMENTS: it's a map now, should be initialized automatically
|
||||
//CoinControlDialog::coinControl()->destChange = CNoDestination();
|
||||
ui->labelCoinControlChangeLabel->clear();
|
||||
}
|
||||
else
|
||||
|
|
@ -800,7 +802,8 @@ void SendCoinsDialog::coinControlChangeEdited(const QString& text)
|
|||
if (model && model->getAddressTableModel())
|
||||
{
|
||||
// Default to no change address until verified
|
||||
CoinControlDialog::coinControl()->destChange = CNoDestination();
|
||||
// ELEMENTS: it's a map now, should be initialized automatically
|
||||
//CoinControlDialog::coinControl()->destChange = CNoDestination();
|
||||
ui->labelCoinControlChangeLabel->setStyleSheet("QLabel{color:red;}");
|
||||
|
||||
const CTxDestination dest = DecodeDestination(text.toStdString());
|
||||
|
|
@ -822,8 +825,10 @@ void SendCoinsDialog::coinControlChangeEdited(const QString& text)
|
|||
QMessageBox::StandardButton btnRetVal = QMessageBox::question(this, tr("Confirm custom change address"), tr("The address you selected for change is not part of this wallet. Any or all funds in your wallet may be sent to this address. Are you sure?"),
|
||||
QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
|
||||
|
||||
if(btnRetVal == QMessageBox::Yes)
|
||||
CoinControlDialog::coinControl()->destChange = dest;
|
||||
if(btnRetVal == QMessageBox::Yes) {
|
||||
// ELEMENTS: it's a map now
|
||||
//CoinControlDialog::coinControl()->destChange = dest;
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->lineEditCoinControlChange->setText("");
|
||||
|
|
@ -842,7 +847,8 @@ void SendCoinsDialog::coinControlChangeEdited(const QString& text)
|
|||
else
|
||||
ui->labelCoinControlChangeLabel->setText(tr("(no label)"));
|
||||
|
||||
CoinControlDialog::coinControl()->destChange = dest;
|
||||
// ELEMENTS: it's a map now
|
||||
//CoinControlDialog::coinControl()->destChange = dest;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ void SignVerifyMessageDialog::on_signMessageButton_SM_clicked()
|
|||
ui->statusLabel_SM->setText(tr("The entered address is invalid.") + QString(" ") + tr("Please check the address and try again."));
|
||||
return;
|
||||
}
|
||||
const CKeyID* keyID = boost::get<CKeyID>(&destination);
|
||||
const PKHash* keyID = boost::get<PKHash>(&destination);
|
||||
if (!keyID) {
|
||||
ui->addressIn_SM->setValid(false);
|
||||
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
|
||||
|
|
@ -137,7 +137,7 @@ void SignVerifyMessageDialog::on_signMessageButton_SM_clicked()
|
|||
}
|
||||
|
||||
CKey key;
|
||||
if (!model->wallet().getPrivKey(*keyID, key))
|
||||
if (!model->wallet().getPrivKey(CKeyID(*keyID), key))
|
||||
{
|
||||
ui->statusLabel_SM->setStyleSheet("QLabel { color: red; }");
|
||||
ui->statusLabel_SM->setText(tr("Private key for the entered address is not available."));
|
||||
|
|
@ -198,7 +198,7 @@ void SignVerifyMessageDialog::on_verifyMessageButton_VM_clicked()
|
|||
ui->statusLabel_VM->setText(tr("The entered address is invalid.") + QString(" ") + tr("Please check the address and try again."));
|
||||
return;
|
||||
}
|
||||
if (!boost::get<CKeyID>(&destination)) {
|
||||
if (!boost::get<PKHash>(&destination)) {
|
||||
ui->addressIn_VM->setValid(false);
|
||||
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
|
||||
ui->statusLabel_VM->setText(tr("The entered address does not refer to a key.") + QString(" ") + tr("Please check the address and try again."));
|
||||
|
|
@ -229,7 +229,7 @@ void SignVerifyMessageDialog::on_verifyMessageButton_VM_clicked()
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(CTxDestination(pubkey.GetID()) == destination)) {
|
||||
if (!(CTxDestination(PKHash(pubkey.GetID())) == destination)) {
|
||||
ui->statusLabel_VM->setStyleSheet("QLabel { color: red; }");
|
||||
ui->statusLabel_VM->setText(QString("<nobr>") + tr("Message verification failed.") + QString("</nobr>"));
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include <qt/transactionview.h>
|
||||
#include <qt/walletmodel.h>
|
||||
#include <key_io.h>
|
||||
#include <policy/policy.h>
|
||||
#include <test/test_bitcoin.h>
|
||||
#include <validation.h>
|
||||
#include <wallet/wallet.h>
|
||||
|
|
@ -164,8 +165,8 @@ void TestGUI()
|
|||
// Send two transactions, and verify they are added to transaction list.
|
||||
TransactionTableModel* transactionTableModel = walletModel.getTransactionTableModel();
|
||||
QCOMPARE(transactionTableModel->rowCount({}), 105);
|
||||
uint256 txid1 = SendCoins(*wallet.get(), sendCoinsDialog, CKeyID(), 5 * COIN, false /* rbf */);
|
||||
uint256 txid2 = SendCoins(*wallet.get(), sendCoinsDialog, CKeyID(), 10 * COIN, true /* rbf */);
|
||||
uint256 txid1 = SendCoins(*wallet.get(), sendCoinsDialog, PKHash(), 5 * COIN, false /* rbf */);
|
||||
uint256 txid2 = SendCoins(*wallet.get(), sendCoinsDialog, PKHash(), 10 * COIN, true /* rbf */);
|
||||
QCOMPARE(transactionTableModel->rowCount({}), 107);
|
||||
QVERIFY(FindTx(*transactionTableModel, txid1).isValid());
|
||||
QVERIFY(FindTx(*transactionTableModel, txid2).isValid());
|
||||
|
|
@ -182,7 +183,7 @@ void TestGUI()
|
|||
QLabel* balanceLabel = overviewPage.findChild<QLabel*>("labelBalance");
|
||||
QString balanceText = balanceLabel->text();
|
||||
int unit = walletModel.getOptionsModel()->getDisplayUnit();
|
||||
CAmount balance = walletModel.wallet().getBalance();
|
||||
CAmount balance = valueFor(walletModel.wallet().getBalance(), ::policyAsset);
|
||||
QString balanceComparison = BitcoinUnits::formatWithUnit(unit, balance, false, BitcoinUnits::separatorAlways);
|
||||
QCOMPARE(balanceText, balanceComparison);
|
||||
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
|
|||
strHTML += "<html><font face='verdana, arial, helvetica, sans-serif'>";
|
||||
|
||||
int64_t nTime = wtx.time;
|
||||
CAmount nCredit = wtx.credit;
|
||||
CAmount nDebit = wtx.debit;
|
||||
CAmount nCredit = valueFor(wtx.credit, ::policyAsset);
|
||||
CAmount nDebit = valueFor(wtx.debit, ::policyAsset);
|
||||
CAmount nNet = nCredit - nDebit;
|
||||
|
||||
strHTML += "<b>" + tr("Status") + ":</b> " + FormatTxStatus(wtx, status, inMempool, numBlocks, adjustedTime);
|
||||
|
|
@ -134,7 +134,7 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
|
|||
//
|
||||
CAmount nUnmatured = 0;
|
||||
for (const CTxOut& txout : wtx.tx->vout)
|
||||
nUnmatured += wallet.getCredit(txout, ISMINE_ALL);
|
||||
nUnmatured += valueFor(wallet.getCredit(txout, ISMINE_ALL), ::policyAsset);
|
||||
strHTML += "<b>" + tr("Credit") + ":</b> ";
|
||||
if (status.is_in_main_chain)
|
||||
strHTML += BitcoinUnits::formatHtmlWithUnit(unit, nUnmatured)+ " (" + tr("matures in %n more block(s)", "", status.blocks_to_maturity) + ")";
|
||||
|
|
@ -199,21 +199,21 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
|
|||
}
|
||||
}
|
||||
|
||||
strHTML += "<b>" + tr("Debit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, -txout.nValue) + "<br>";
|
||||
strHTML += "<b>" + tr("Debit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, -txout.nValue.GetAmount()) + "<br>";
|
||||
if(toSelf)
|
||||
strHTML += "<b>" + tr("Credit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, txout.nValue) + "<br>";
|
||||
strHTML += "<b>" + tr("Credit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, txout.nValue.GetAmount()) + "<br>";
|
||||
}
|
||||
|
||||
if (fAllToMe)
|
||||
{
|
||||
// Payment to self
|
||||
CAmount nChange = wtx.change;
|
||||
CAmount nChange = valueFor(wtx.change, ::policyAsset);
|
||||
CAmount nValue = nCredit - nChange;
|
||||
strHTML += "<b>" + tr("Total debit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, -nValue) + "<br>";
|
||||
strHTML += "<b>" + tr("Total credit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, nValue) + "<br>";
|
||||
}
|
||||
|
||||
CAmount nTxFee = nDebit - wtx.tx->GetValueOut();
|
||||
CAmount nTxFee = nDebit - valueFor(wtx.tx->GetValueOutMap(), ::policyAsset);
|
||||
if (nTxFee > 0)
|
||||
strHTML += "<b>" + tr("Transaction fee") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, -nTxFee) + "<br>";
|
||||
}
|
||||
|
|
@ -225,13 +225,13 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
|
|||
auto mine = wtx.txin_is_mine.begin();
|
||||
for (const CTxIn& txin : wtx.tx->vin) {
|
||||
if (*(mine++)) {
|
||||
strHTML += "<b>" + tr("Debit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, -wallet.getDebit(txin, ISMINE_ALL)) + "<br>";
|
||||
strHTML += "<b>" + tr("Debit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, -valueFor(wallet.getDebit(txin, ISMINE_ALL), ::policyAsset)) + "<br>";
|
||||
}
|
||||
}
|
||||
mine = wtx.txout_is_mine.begin();
|
||||
for (const CTxOut& txout : wtx.tx->vout) {
|
||||
if (*(mine++)) {
|
||||
strHTML += "<b>" + tr("Credit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, wallet.getCredit(txout, ISMINE_ALL)) + "<br>";
|
||||
strHTML += "<b>" + tr("Credit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, valueFor(wallet.getCredit(txout, ISMINE_ALL), ::policyAsset)) + "<br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -286,10 +286,10 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
|
|||
strHTML += "<hr><br>" + tr("Debug information") + "<br><br>";
|
||||
for (const CTxIn& txin : wtx.tx->vin)
|
||||
if(wallet.txinIsMine(txin))
|
||||
strHTML += "<b>" + tr("Debit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, -wallet.getDebit(txin, ISMINE_ALL)) + "<br>";
|
||||
strHTML += "<b>" + tr("Debit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, -valueFor(wallet.getDebit(txin, ISMINE_ALL), ::policyAsset)) + "<br>";
|
||||
for (const CTxOut& txout : wtx.tx->vout)
|
||||
if(wallet.txoutIsMine(txout))
|
||||
strHTML += "<b>" + tr("Credit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, wallet.getCredit(txout, ISMINE_ALL)) + "<br>";
|
||||
strHTML += "<b>" + tr("Credit") + ":</b> " + BitcoinUnits::formatHtmlWithUnit(unit, valueFor(wallet.getCredit(txout, ISMINE_ALL), ::policyAsset)) + "<br>";
|
||||
|
||||
strHTML += "<br><b>" + tr("Transaction") + ":</b><br>";
|
||||
strHTML += GUIUtil::HtmlEscape(wtx.tx->ToString(), true);
|
||||
|
|
@ -315,7 +315,7 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
|
|||
strHTML += GUIUtil::HtmlEscape(name) + " ";
|
||||
strHTML += QString::fromStdString(EncodeDestination(address));
|
||||
}
|
||||
strHTML = strHTML + " " + tr("Amount") + "=" + BitcoinUnits::formatHtmlWithUnit(unit, vout.nValue);
|
||||
strHTML = strHTML + " " + tr("Amount") + "=" + BitcoinUnits::formatHtmlWithUnit(unit, vout.nValue.GetAmount());
|
||||
strHTML = strHTML + " IsMine=" + (wallet.txoutIsMine(vout) & ISMINE_SPENDABLE ? tr("true") : tr("false")) + "</li>";
|
||||
strHTML = strHTML + " IsWatchOnly=" + (wallet.txoutIsMine(vout) & ISMINE_WATCH_ONLY ? tr("true") : tr("false")) + "</li>";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include <consensus/consensus.h>
|
||||
#include <interfaces/wallet.h>
|
||||
#include <key_io.h>
|
||||
#include <policy/policy.h>
|
||||
#include <timedata.h>
|
||||
#include <validation.h>
|
||||
|
||||
|
|
@ -29,8 +30,8 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
|
|||
{
|
||||
QList<TransactionRecord> parts;
|
||||
int64_t nTime = wtx.time;
|
||||
CAmount nCredit = wtx.credit;
|
||||
CAmount nDebit = wtx.debit;
|
||||
CAmount nCredit = valueFor(wtx.credit, ::policyAsset);
|
||||
CAmount nDebit = valueFor(wtx.debit, ::policyAsset);
|
||||
CAmount nNet = nCredit - nDebit;
|
||||
uint256 hash = wtx.tx->GetHash();
|
||||
std::map<std::string, std::string> mapValue = wtx.value_map;
|
||||
|
|
@ -49,7 +50,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
|
|||
TransactionRecord sub(hash, nTime);
|
||||
CTxDestination address;
|
||||
sub.idx = i; // vout index
|
||||
sub.credit = txout.nValue;
|
||||
sub.credit = txout.nValue.GetAmount();
|
||||
sub.involvesWatchAddress = mine & ISMINE_WATCH_ONLY;
|
||||
if (wtx.txout_address_is_mine[i])
|
||||
{
|
||||
|
|
@ -93,7 +94,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
|
|||
if (fAllFromMe && fAllToMe)
|
||||
{
|
||||
// Payment to self
|
||||
CAmount nChange = wtx.change;
|
||||
CAmount nChange = valueFor(wtx.change, ::policyAsset);
|
||||
|
||||
parts.append(TransactionRecord(hash, nTime, TransactionRecord::SendToSelf, "",
|
||||
-(nDebit - nChange), nCredit - nChange));
|
||||
|
|
@ -104,7 +105,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
|
|||
//
|
||||
// Debit
|
||||
//
|
||||
CAmount nTxFee = nDebit - wtx.tx->GetValueOut();
|
||||
CAmount nTxFee = nDebit - wtx.tx->GetValueOutMap()[::policyAsset];
|
||||
|
||||
for (unsigned int nOut = 0; nOut < wtx.tx->vout.size(); nOut++)
|
||||
{
|
||||
|
|
@ -133,7 +134,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
|
|||
sub.address = mapValue["to"];
|
||||
}
|
||||
|
||||
CAmount nValue = txout.nValue;
|
||||
CAmount nValue = txout.nValue.GetAmount();
|
||||
/* Add fee to first output */
|
||||
if (nTxFee > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include <interfaces/handler.h>
|
||||
#include <interfaces/node.h>
|
||||
#include <key_io.h>
|
||||
#include <policy/policy.h>
|
||||
#include <ui_interface.h>
|
||||
#include <util.h> // for GetBoolArg
|
||||
#include <wallet/coincontrol.h>
|
||||
|
|
@ -154,7 +155,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
|
|||
const unsigned char* scriptStr = (const unsigned char*)out.script().data();
|
||||
CScript scriptPubKey(scriptStr, scriptStr+out.script().size());
|
||||
CAmount nAmount = out.amount();
|
||||
CRecipient recipient = {scriptPubKey, nAmount, rcp.fSubtractFeeFromAmount};
|
||||
CRecipient recipient = {scriptPubKey, nAmount, ::policyAsset, CPubKey(), rcp.fSubtractFeeFromAmount};
|
||||
vecSend.push_back(recipient);
|
||||
}
|
||||
if (subtotal <= 0)
|
||||
|
|
@ -177,7 +178,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
|
|||
++nAddresses;
|
||||
|
||||
CScript scriptPubKey = GetScriptForDestination(DecodeDestination(rcp.address.toStdString()));
|
||||
CRecipient recipient = {scriptPubKey, rcp.amount, rcp.fSubtractFeeFromAmount};
|
||||
CRecipient recipient = {scriptPubKey, rcp.amount, ::policyAsset, CPubKey(), rcp.fSubtractFeeFromAmount};
|
||||
vecSend.push_back(recipient);
|
||||
|
||||
total += rcp.amount;
|
||||
|
|
@ -188,7 +189,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
|
|||
return DuplicateAddress;
|
||||
}
|
||||
|
||||
CAmount nBalance = m_wallet->getAvailableBalance(coinControl);
|
||||
CAmount nBalance = m_wallet->getAvailableBalance(coinControl)[::policyAsset];
|
||||
|
||||
if(total > nBalance)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ void WalletModelTransaction::reassignAmounts(int nChangePosRet)
|
|||
if (out.amount() <= 0) continue;
|
||||
if (i == nChangePosRet)
|
||||
i++;
|
||||
subtotal += walletTransaction->vout[i].nValue;
|
||||
subtotal += walletTransaction->vout[i].nValue.GetAmount();
|
||||
i++;
|
||||
}
|
||||
rcp.amount = subtotal;
|
||||
|
|
@ -65,7 +65,7 @@ void WalletModelTransaction::reassignAmounts(int nChangePosRet)
|
|||
{
|
||||
if (i == nChangePosRet)
|
||||
i++;
|
||||
rcp.amount = walletTransaction->vout[i].nValue;
|
||||
rcp.amount = walletTransaction->vout[i].nValue.GetAmount();
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue