From 41c8d4c89c590f2cf4e75a24702460c78a71e7f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Barbosa?= Date: Thu, 1 Mar 2018 17:39:42 +0000 Subject: [PATCH 01/97] gui: Avoid TransactionRecord instance for IsMine outputs Github-Pull: bitcoin/bitcoin #12578 Rebased-From: 82dd3e0ffa0af629a34b28ed7eca4027e0376756 --- src/qt/transactionrecord.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 5dd1f91902..727dbf6f4a 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -110,9 +110,6 @@ QList TransactionRecord::decomposeTransaction(const interface for (unsigned int nOut = 0; nOut < wtx.tx->vout.size(); nOut++) { const CTxOut& txout = wtx.tx->vout[nOut]; - TransactionRecord sub(hash, nTime); - sub.idx = nOut; - sub.involvesWatchAddress = involvesWatchAddress; if(wtx.txout_is_mine[nOut]) { @@ -121,6 +118,10 @@ QList TransactionRecord::decomposeTransaction(const interface continue; } + TransactionRecord sub(hash, nTime); + sub.idx = nOut; + sub.involvesWatchAddress = involvesWatchAddress; + if (!boost::get(&wtx.txout_address[nOut])) { // Sent to Bitcoin Address From 3edcdf8f0b3f6520b91f1f7aa83340b5b63baf13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Barbosa?= Date: Thu, 1 Mar 2018 18:20:17 +0000 Subject: [PATCH 02/97] gui: Add transaction record type Fee Github-Pull: bitcoin/bitcoin #12578 Rebased-From: 550f1f3d3498d051ab94afdc0b9fb883c0655b99 --- src/interfaces/wallet.cpp | 5 +++++ src/interfaces/wallet.h | 2 ++ src/qt/transactionrecord.cpp | 22 ++++++++++------------ src/qt/transactionrecord.h | 3 ++- src/qt/transactiontablemodel.cpp | 3 +++ src/qt/transactionview.cpp | 1 + 6 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index 74c03c1399..496d83f435 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -74,6 +74,11 @@ static WalletTx MakeWalletTx(CWallet& wallet, const CWalletTx& wtx) EXCLUSIVE_LO IsMine(wallet, result.txout_address.back()) : ISMINE_NO); } + // ELEMENTS: Retrieve unblinded information about outputs + for (unsigned int i = 0; i < wtx.tx->vout.size(); ++i) { + result.txout_amounts.emplace_back(wtx.GetOutputValueOut(i)); + result.txout_assets.emplace_back(wtx.GetOutputAsset(i)); + } result.credit = wtx.GetCredit(ISMINE_ALL); result.debit = wtx.GetDebit(ISMINE_ALL); result.change = wtx.GetChange(); diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index e9f8d31975..ca7c104c93 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -335,6 +335,8 @@ struct WalletTx std::vector txout_is_mine; std::vector txout_address; std::vector txout_address_is_mine; + std::vector txout_amounts; + std::vector txout_assets; CAmountMap credit; CAmountMap debit; CAmountMap change; diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 727dbf6f4a..e8cd8a408c 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -105,13 +105,12 @@ QList TransactionRecord::decomposeTransaction(const interface // // Debit // - CAmount nTxFee = nDebit - wtx.tx->GetValueOutMap()[::policyAsset]; for (unsigned int nOut = 0; nOut < wtx.tx->vout.size(); nOut++) { const CTxOut& txout = wtx.tx->vout[nOut]; - if(wtx.txout_is_mine[nOut]) + if(wtx.txout_is_mine[nOut] || txout.IsFee()) { // Ignore parts sent to self, as this is usually the change // from a transaction sent back to our own address. @@ -121,6 +120,7 @@ QList TransactionRecord::decomposeTransaction(const interface TransactionRecord sub(hash, nTime); sub.idx = nOut; sub.involvesWatchAddress = involvesWatchAddress; + sub.debit = -wtx.txout_amounts[nOut]; if (!boost::get(&wtx.txout_address[nOut])) { @@ -134,16 +134,14 @@ QList TransactionRecord::decomposeTransaction(const interface sub.type = TransactionRecord::SendToOther; sub.address = mapValue["to"]; } - - CAmount nValue = txout.nValue.GetAmount(); - /* Add fee to first output */ - if (nTxFee > 0) - { - nValue += nTxFee; - nTxFee = 0; - } - sub.debit = -nValue; - + parts.append(sub); + } + CAmount nTxFee = GetFeeMap(*wtx.tx)[::policyAsset]; + if (nTxFee > 0) + { + TransactionRecord sub(hash, nTime); + sub.type = TransactionRecord::Fee; + sub.debit = -nTxFee; parts.append(sub); } } diff --git a/src/qt/transactionrecord.h b/src/qt/transactionrecord.h index e187309d3f..913005f23d 100644 --- a/src/qt/transactionrecord.h +++ b/src/qt/transactionrecord.h @@ -81,7 +81,8 @@ class TransactionRecord SendToOther, RecvWithAddress, RecvFromOther, - SendToSelf + SendToSelf, + Fee }; /** Number of confirmation recommended for accepting a transaction */ diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index b4be068904..35a9bd0fa4 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -356,6 +356,8 @@ QString TransactionTableModel::formatTxType(const TransactionRecord *wtx) const return tr("Payment to yourself"); case TransactionRecord::Generated: return tr("Mined"); + case TransactionRecord::Fee: + return tr("Fee"); default: return QString(); } @@ -372,6 +374,7 @@ QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord *wtx return QIcon(":/icons/tx_input"); case TransactionRecord::SendToAddress: case TransactionRecord::SendToOther: + case TransactionRecord::Fee: return QIcon(":/icons/tx_output"); default: return QIcon(":/icons/tx_inout"); diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 6d08a3b0fb..07144aa1c6 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -91,6 +91,7 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa TransactionFilterProxy::TYPE(TransactionRecord::SendToOther)); typeWidget->addItem(tr("To yourself"), TransactionFilterProxy::TYPE(TransactionRecord::SendToSelf)); typeWidget->addItem(tr("Mined"), TransactionFilterProxy::TYPE(TransactionRecord::Generated)); + typeWidget->addItem(tr("Fee"), TransactionFilterProxy::TYPE(TransactionRecord::Fee)); typeWidget->addItem(tr("Other"), TransactionFilterProxy::TYPE(TransactionRecord::Other)); hlayout->addWidget(typeWidget); From 1655947c155d86eaacf34a2c948656a1cbe39786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Barbosa?= Date: Tue, 6 Mar 2018 13:53:30 +0000 Subject: [PATCH 03/97] gui: Alternate row background based on txid Github-Pull: bitcoin/bitcoin #12578 Rebased-From: 264f9c4d4f7c1aeb3e89eedddcd88e47e8bba938 --- src/qt/transactionview.cpp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 07144aa1c6..ea8883e6ce 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -26,9 +26,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -37,6 +39,37 @@ #include #include +class TransactionRecordDelegate : public QItemDelegate +{ + QSortFilterProxyModel* m_proxy; + + void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const + { + bool alternate = false; + QVariant previous_hash; + + for (int row = 0; row <= index.row(); ++row) { + QModelIndex sibling = m_proxy->mapToSource(index.sibling(row, 0)); + QVariant hash = sibling.data(TransactionTableModel::TxHashRole); + if (row == 0) { + previous_hash = hash; + } else if (hash != previous_hash) { + alternate = !alternate; + previous_hash = hash; + } + } + + if (alternate) { + painter->fillRect(option.rect, option.palette.alternateBase()); + } + + QItemDelegate::paint(painter, option, index); + } + +public: + TransactionRecordDelegate(QSortFilterProxyModel* proxy) : m_proxy(proxy) {} +}; + TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *parent) : QWidget(parent), model(0), transactionProxyModel(0), transactionView(0), abandonAction(0), bumpFeeAction(0), columnResizingFixer(0) @@ -223,7 +256,7 @@ void TransactionView::setModel(WalletModel *_model) transactionView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); transactionView->setModel(transactionProxyModel); - transactionView->setAlternatingRowColors(true); + transactionView->setItemDelegate(new TransactionRecordDelegate(transactionProxyModel)); transactionView->setSelectionBehavior(QAbstractItemView::SelectRows); transactionView->setSelectionMode(QAbstractItemView::ExtendedSelection); transactionView->setSortingEnabled(true); From 0aeab14f75f44422e33218710bebff53aee64ce5 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 22 Nov 2018 09:52:50 +0000 Subject: [PATCH 04/97] GUI: Ignore explicit fee output when determining if a transaction is send-to-self --- src/qt/transactionrecord.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index e8cd8a408c..a487adbe7e 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -85,8 +85,13 @@ QList TransactionRecord::decomposeTransaction(const interface } isminetype fAllToMe = ISMINE_SPENDABLE; - for (const isminetype mine : wtx.txout_is_mine) - { + for (unsigned int i = 0; i < wtx.txout_is_mine.size(); ++i) { + const isminetype mine = wtx.txout_is_mine[i]; + const CTxOut txout = wtx.tx->vout[i]; + if (txout.IsFee()) { + // explicit fee; ignore + continue; + } if(mine & ISMINE_WATCH_ONLY) involvesWatchAddress = true; if(fAllToMe > mine) fAllToMe = mine; } From 060ad2f566e641b5c9342b29bad5903b8fa31c56 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sat, 15 Dec 2018 02:31:51 +0000 Subject: [PATCH 05/97] GUI: TransactionRecord: Collapse credit+debit fields to just amount --- src/qt/transactionrecord.cpp | 11 +++++------ src/qt/transactionrecord.h | 14 +++++++------- src/qt/transactiontablemodel.cpp | 8 ++++---- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index a487adbe7e..326efc3137 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -43,14 +43,13 @@ QList TransactionRecord::decomposeTransaction(const interface // for(unsigned int i = 0; i < wtx.tx->vout.size(); i++) { - const CTxOut& txout = wtx.tx->vout[i]; isminetype mine = wtx.txout_is_mine[i]; if(mine) { TransactionRecord sub(hash, nTime); CTxDestination address; sub.idx = i; // vout index - sub.credit = txout.nValue.GetAmount(); + sub.amount = wtx.txout_amounts[i]; sub.involvesWatchAddress = mine & ISMINE_WATCH_ONLY; if (wtx.txout_address_is_mine[i]) { @@ -102,7 +101,7 @@ QList TransactionRecord::decomposeTransaction(const interface CAmount nChange = valueFor(wtx.change, ::policyAsset); parts.append(TransactionRecord(hash, nTime, TransactionRecord::SendToSelf, "", - -(nDebit - nChange), nCredit - nChange)); + -(nDebit - nChange) + (nCredit - nChange))); parts.last().involvesWatchAddress = involvesWatchAddress; // maybe pass to TransactionRecord as constructor argument } else if (fAllFromMe) @@ -125,7 +124,7 @@ QList TransactionRecord::decomposeTransaction(const interface TransactionRecord sub(hash, nTime); sub.idx = nOut; sub.involvesWatchAddress = involvesWatchAddress; - sub.debit = -wtx.txout_amounts[nOut]; + sub.amount = -wtx.txout_amounts[nOut]; if (!boost::get(&wtx.txout_address[nOut])) { @@ -146,7 +145,7 @@ QList TransactionRecord::decomposeTransaction(const interface { TransactionRecord sub(hash, nTime); sub.type = TransactionRecord::Fee; - sub.debit = -nTxFee; + sub.amount = -nTxFee; parts.append(sub); } } @@ -155,7 +154,7 @@ QList TransactionRecord::decomposeTransaction(const interface // // Mixed debit transaction, can't break down payees // - parts.append(TransactionRecord(hash, nTime, TransactionRecord::Other, "", nNet, 0)); + parts.append(TransactionRecord(hash, nTime, TransactionRecord::Other, "", nNet)); parts.last().involvesWatchAddress = involvesWatchAddress; } } diff --git a/src/qt/transactionrecord.h b/src/qt/transactionrecord.h index 913005f23d..8341c8ef76 100644 --- a/src/qt/transactionrecord.h +++ b/src/qt/transactionrecord.h @@ -89,20 +89,21 @@ class TransactionRecord static const int RecommendedNumConfirmations = 6; TransactionRecord(): - hash(), time(0), type(Other), address(""), debit(0), credit(0), idx(0) + hash(), time(0), type(Other), address(""), amount(0), idx(0) { } TransactionRecord(uint256 _hash, qint64 _time): - hash(_hash), time(_time), type(Other), address(""), debit(0), - credit(0), idx(0) + hash(_hash), time(_time), type(Other), address(""), amount(0), + idx(0) { } TransactionRecord(uint256 _hash, qint64 _time, Type _type, const std::string &_address, - const CAmount& _debit, const CAmount& _credit): - hash(_hash), time(_time), type(_type), address(_address), debit(_debit), credit(_credit), + const CAmount& _amount): + hash(_hash), time(_time), type(_type), address(_address), + amount(_amount), idx(0) { } @@ -118,8 +119,7 @@ class TransactionRecord qint64 time; Type type; std::string address; - CAmount debit; - CAmount credit; + CAmount amount; /**@}*/ /** Subtransaction index, for sort key */ diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 35a9bd0fa4..554e7e6949 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -428,7 +428,7 @@ QVariant TransactionTableModel::addressColor(const TransactionRecord *wtx) const QString TransactionTableModel::formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed, BitcoinUnits::SeparatorStyle separators) const { - QString str = BitcoinUnits::format(walletModel->getOptionsModel()->getDisplayUnit(), wtx->credit + wtx->debit, false, separators); + QString str = BitcoinUnits::format(walletModel->getOptionsModel()->getDisplayUnit(), wtx->amount, false, separators); if(showUnconfirmed) { if(!wtx->status.countsForBalance) @@ -546,7 +546,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const case ToAddress: return formatTxToAddress(rec, true); case Amount: - return qint64(rec->credit + rec->debit); + return qint64(rec->amount); } break; case Qt::ToolTipRole: @@ -564,7 +564,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const { return COLOR_UNCONFIRMED; } - if(index.column() == Amount && (rec->credit+rec->debit) < 0) + if (index.column() == Amount && rec->amount < 0) { return COLOR_NEGATIVE; } @@ -588,7 +588,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const case LabelRole: return walletModel->getAddressTableModel()->labelForAddress(QString::fromStdString(rec->address)); case AmountRole: - return qint64(rec->credit + rec->debit); + return qint64(rec->amount); case TxHashRole: return rec->getTxHash(); case TxHexRole: From ef2f717e67a01e89f82acfa57594770eac86455e Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Mon, 8 Apr 2019 11:24:23 -0400 Subject: [PATCH 06/97] GUI: TransactionRecord: Add asset field --- src/qt/transactionrecord.cpp | 9 +++++++-- src/qt/transactionrecord.h | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 326efc3137..f6a18f228e 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -56,17 +56,20 @@ QList TransactionRecord::decomposeTransaction(const interface // Received by Bitcoin Address sub.type = TransactionRecord::RecvWithAddress; sub.address = EncodeDestination(wtx.txout_address[i]); + sub.asset = wtx.txout_assets[i]; } else { // Received by IP connection (deprecated features), or a multisignature or other non-simple transaction sub.type = TransactionRecord::RecvFromOther; sub.address = mapValue["from"]; + sub.asset = wtx.txout_assets[i]; } if (wtx.is_coinbase) { // Generated sub.type = TransactionRecord::Generated; + sub.asset = wtx.txout_assets[i]; } parts.append(sub); @@ -101,7 +104,7 @@ QList TransactionRecord::decomposeTransaction(const interface CAmount nChange = valueFor(wtx.change, ::policyAsset); parts.append(TransactionRecord(hash, nTime, TransactionRecord::SendToSelf, "", - -(nDebit - nChange) + (nCredit - nChange))); + -(nDebit - nChange) + (nCredit - nChange), ::policyAsset)); parts.last().involvesWatchAddress = involvesWatchAddress; // maybe pass to TransactionRecord as constructor argument } else if (fAllFromMe) @@ -125,6 +128,7 @@ QList TransactionRecord::decomposeTransaction(const interface sub.idx = nOut; sub.involvesWatchAddress = involvesWatchAddress; sub.amount = -wtx.txout_amounts[nOut]; + sub.asset = wtx.txout_assets[nOut]; if (!boost::get(&wtx.txout_address[nOut])) { @@ -146,6 +150,7 @@ QList TransactionRecord::decomposeTransaction(const interface TransactionRecord sub(hash, nTime); sub.type = TransactionRecord::Fee; sub.amount = -nTxFee; + sub.asset = ::policyAsset; parts.append(sub); } } @@ -154,7 +159,7 @@ QList TransactionRecord::decomposeTransaction(const interface // // Mixed debit transaction, can't break down payees // - parts.append(TransactionRecord(hash, nTime, TransactionRecord::Other, "", nNet)); + parts.append(TransactionRecord(hash, nTime, TransactionRecord::Other, "", nNet, CAsset())); parts.last().involvesWatchAddress = involvesWatchAddress; } } diff --git a/src/qt/transactionrecord.h b/src/qt/transactionrecord.h index 8341c8ef76..ee087e5b11 100644 --- a/src/qt/transactionrecord.h +++ b/src/qt/transactionrecord.h @@ -6,6 +6,7 @@ #define BITCOIN_QT_TRANSACTIONRECORD_H #include +#include #include #include @@ -101,9 +102,9 @@ class TransactionRecord TransactionRecord(uint256 _hash, qint64 _time, Type _type, const std::string &_address, - const CAmount& _amount): + const CAmount& _amount, const CAsset& _asset): hash(_hash), time(_time), type(_type), address(_address), - amount(_amount), + amount(_amount), asset(_asset), idx(0) { } @@ -120,6 +121,7 @@ class TransactionRecord Type type; std::string address; CAmount amount; + CAsset asset; /**@}*/ /** Subtransaction index, for sort key */ From a582fe03e42afce476af4cfb128792a715c72e97 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sat, 15 Dec 2018 04:42:25 +0000 Subject: [PATCH 07/97] GUI: TransactionRecord: Turn non-bitcoin fees into entries --- src/qt/transactionrecord.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index f6a18f228e..9663c72bbd 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -144,13 +144,13 @@ QList TransactionRecord::decomposeTransaction(const interface } parts.append(sub); } - CAmount nTxFee = GetFeeMap(*wtx.tx)[::policyAsset]; - if (nTxFee > 0) - { + + for (const auto& tx_fee : GetFeeMap(*wtx.tx)) { + if (!tx_fee.second) continue; TransactionRecord sub(hash, nTime); sub.type = TransactionRecord::Fee; - sub.amount = -nTxFee; - sub.asset = ::policyAsset; + sub.asset = tx_fee.first; + sub.amount = -tx_fee.second; parts.append(sub); } } From 19c87c0ae7693c9672ac2b0ae98e7a5bd80c40b4 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sat, 15 Dec 2018 19:31:20 +0000 Subject: [PATCH 08/97] GUI: TransactionTableModel: Include unit name with formatted amount --- src/qt/transactiontablemodel.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 554e7e6949..04e361cf8a 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -13,6 +13,7 @@ #include #include +#include "assetsdir.h" #include #include #include @@ -20,6 +21,7 @@ #include #include #include +#include #include #include @@ -428,7 +430,22 @@ QVariant TransactionTableModel::addressColor(const TransactionRecord *wtx) const QString TransactionTableModel::formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed, BitcoinUnits::SeparatorStyle separators) const { - QString str = BitcoinUnits::format(walletModel->getOptionsModel()->getDisplayUnit(), wtx->amount, false, separators); + QString str; + if (wtx->asset == ::policyAsset) { + str = BitcoinUnits::formatWithUnit(walletModel->getOptionsModel()->getDisplayUnit(), wtx->amount, false, separators); + } else { + qlonglong whole = wtx->amount / 100000000; + qlonglong fraction = wtx->amount % 100000000; + str = QString("%1").arg(whole); + if (fraction) { + str += QString(".%1").arg(fraction, 8, 10, QLatin1Char('0')); + } + std::string asset_label = gAssetsDir.GetLabel(wtx->asset); + if (asset_label.empty()) { + asset_label = wtx->asset.GetHex(); + } + str += QString(" ") + QString::fromStdString(asset_label); + } if(showUnconfirmed) { if(!wtx->status.countsForBalance) From eef551a5885404beea7bdb815087d153ea39a85f Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sat, 15 Dec 2018 20:14:57 +0000 Subject: [PATCH 09/97] GUI: TransactionTableModel: Remove bitcoin unit from Amount column header --- src/qt/transactiontablemodel.cpp | 9 +-------- src/qt/transactiontablemodel.h | 2 -- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 04e361cf8a..f09c0864d9 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -227,7 +227,7 @@ TransactionTableModel::TransactionTableModel(const PlatformStyle *_platformStyle fProcessingQueuedTransactions(false), platformStyle(_platformStyle) { - columns << QString() << QString() << tr("Date") << tr("Type") << tr("Label") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit()); + columns << QString() << QString() << tr("Date") << tr("Type") << tr("Label") << tr("Amount"); priv->refreshWallet(walletModel->wallet()); connect(walletModel->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &TransactionTableModel::updateDisplayUnit); @@ -241,12 +241,6 @@ TransactionTableModel::~TransactionTableModel() delete priv; } -/** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */ -void TransactionTableModel::updateAmountColumnTitle() -{ - columns[Amount] = BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit()); - Q_EMIT headerDataChanged(Qt::Horizontal,Amount,Amount); -} void TransactionTableModel::updateTransaction(const QString &hash, int status, bool showTransaction) { @@ -696,7 +690,6 @@ QModelIndex TransactionTableModel::index(int row, int column, const QModelIndex void TransactionTableModel::updateDisplayUnit() { // emit dataChanged to update Amount column with the current unit - updateAmountColumnTitle(); Q_EMIT dataChanged(index(0, Amount), index(priv->size()-1, Amount)); } diff --git a/src/qt/transactiontablemodel.h b/src/qt/transactiontablemodel.h index 8be3a7ab2e..d846627a23 100644 --- a/src/qt/transactiontablemodel.h +++ b/src/qt/transactiontablemodel.h @@ -112,8 +112,6 @@ public Q_SLOTS: void updateTransaction(const QString &hash, int status, bool showTransaction); void updateConfirmations(); void updateDisplayUnit(); - /** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */ - void updateAmountColumnTitle(); /* Needed to update fProcessingQueuedTransactions through a QueuedConnection */ void setProcessingQueuedTransactions(bool value) { fProcessingQueuedTransactions = value; } From 2bcd24313dbd00fef8cae739acb999681b2db1b0 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sat, 15 Dec 2018 20:26:02 +0000 Subject: [PATCH 10/97] GUI: Overview: Use formatted amount text from TransactionTableModel --- src/qt/overviewpage.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 465086e342..12fda181ca 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -88,11 +88,7 @@ class TxViewDelegate : public QAbstractItemDelegate foreground = option.palette.color(QPalette::Text); } painter->setPen(foreground); - QString amountText = BitcoinUnits::formatWithUnit(unit, amount, true, BitcoinUnits::separatorAlways); - if(!confirmed) - { - amountText = QString("[") + amountText + QString("]"); - } + QString amountText = index.sibling(index.row(), TransactionTableModel::Amount).data(Qt::DisplayRole).toString(); painter->drawText(amountRect, Qt::AlignRight|Qt::AlignVCenter, amountText); painter->setPen(option.palette.color(QPalette::Text)); From e6b3676b3758a60b1d5428ef9c689c9ee45ecc5f Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Mon, 8 Apr 2019 15:27:03 -0400 Subject: [PATCH 11/97] Wallet: GetIssuanceAssets to just get CAssets for issuances --- src/wallet/wallet.cpp | 75 +++++++++++++++++++++++-------------------- src/wallet/wallet.h | 2 ++ 2 files changed, 43 insertions(+), 34 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 697c726a9e..5e85c671cc 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -5196,32 +5196,52 @@ CPubKey CWalletTx::GetOutputBlindingPubKey(unsigned int output_index) const { return ret; } +void CWalletTx::GetIssuanceAssets(unsigned int vinIndex, CAsset* out_asset, CAsset* out_reissuance_token) const { + assert(vinIndex < tx->vin.size()); + const CAssetIssuance& issuance = tx->vin[vinIndex].assetIssuance; + + if (out_asset && issuance.nAmount.IsNull()) { + out_asset->SetNull(); + out_asset = nullptr; + } + if (out_reissuance_token && issuance.nInflationKeys.IsNull()) { + out_reissuance_token->SetNull(); + out_reissuance_token = nullptr; + } + if (!(out_asset || out_reissuance_token)) return; + + if (issuance.assetBlindingNonce.IsNull()) { + uint256 entropy; + GenerateAssetEntropy(entropy, tx->vin[vinIndex].prevout, issuance.assetEntropy); + if (out_reissuance_token) { + CalculateReissuanceToken(*out_reissuance_token, entropy, issuance.nAmount.IsCommitment()); + } + if (out_asset) { + CalculateAsset(*out_asset, entropy); + } + } + else { + if (out_reissuance_token) { + // Re-issuances don't emit issuance tokens + out_reissuance_token->SetNull(); + } + if (out_asset) { + CalculateAsset(*out_asset, issuance.assetEntropy); + } + } +} + uint256 CWalletTx::GetIssuanceBlindingFactor(unsigned int input_index, bool reissuance_token) const { assert(input_index < tx->vin.size()); CAsset asset; const CAssetIssuance& issuance = tx->vin[input_index].assetIssuance; const CTxWitness& wit = tx->witness; - if ((issuance.nAmount.IsNull() && !reissuance_token) || (issuance.nInflationKeys.IsNull() && reissuance_token)) { + GetIssuanceAssets(input_index, reissuance_token ? nullptr : &asset, reissuance_token ? &asset : nullptr); + if (asset.IsNull()) { return uint256(); } const std::vector& rangeproof = wit.vtxinwit.size() <= input_index ? std::vector() : (reissuance_token ? wit.vtxinwit[input_index].vchInflationKeysRangeproof : wit.vtxinwit[input_index].vchIssuanceAmountRangeproof); unsigned int mapValueInd = GetPseudoInputOffset(input_index, reissuance_token)+tx->vout.size(); - if (issuance.assetBlindingNonce.IsNull()) { - uint256 entropy; - GenerateAssetEntropy(entropy, tx->vin[input_index].prevout, issuance.assetEntropy); - if (reissuance_token) { - CalculateReissuanceToken(asset, entropy, issuance.nInflationKeys.IsCommitment()); - } else { - CalculateAsset(asset, entropy); - } - } - else { - if (reissuance_token) { - // Re-issuances don't emit issuance tokens - return uint256(); - } - CalculateAsset(asset, issuance.assetEntropy); - } uint256 ret; CScript blindingScript(CScript() << OP_RETURN << std::vector(tx->vin[input_index].prevout.hash.begin(), tx->vin[input_index].prevout.hash.end()) << tx->vin[input_index].prevout.n); @@ -5232,31 +5252,18 @@ uint256 CWalletTx::GetIssuanceBlindingFactor(unsigned int input_index, bool reis CAmount CWalletTx::GetIssuanceAmount(unsigned int input_index, bool reissuance_token) const { assert(input_index < tx->vin.size()); CAsset asset; - CAsset token; const CAssetIssuance& issuance = tx->vin[input_index].assetIssuance; const CTxWitness& wit = tx->witness; - if ((issuance.nAmount.IsNull() && !reissuance_token) || (issuance.nInflationKeys.IsNull() && reissuance_token)) { - return 0; + GetIssuanceAssets(input_index, reissuance_token ? nullptr : &asset, reissuance_token ? &asset : nullptr); + if (asset.IsNull()) { + return -1; } unsigned int mapValueInd = GetPseudoInputOffset(input_index, reissuance_token)+tx->vout.size(); const std::vector& rangeproof = wit.vtxinwit.size() <= input_index ? std::vector() : (reissuance_token ? wit.vtxinwit[input_index].vchInflationKeysRangeproof : wit.vtxinwit[input_index].vchIssuanceAmountRangeproof); - if (issuance.assetBlindingNonce.IsNull()) { - uint256 entropy; - GenerateAssetEntropy(entropy, tx->vin[input_index].prevout, issuance.assetEntropy); - CalculateReissuanceToken(token, entropy, issuance.nAmount.IsCommitment()); - CalculateAsset(asset, entropy); - } - else { - if (reissuance_token) { - // Re-issuances don't emit issuance tokens - return -1; - } - CalculateAsset(asset, issuance.assetEntropy); - } CAmount ret; CScript blindingScript(CScript() << OP_RETURN << std::vector(tx->vin[input_index].prevout.hash.begin(), tx->vin[input_index].prevout.hash.end()) << tx->vin[input_index].prevout.n); - GetBlindingData(mapValueInd, rangeproof, reissuance_token ? issuance.nInflationKeys : issuance.nAmount, CConfidentialAsset((reissuance_token ? token : asset)), CConfidentialNonce(), blindingScript, nullptr, &ret, nullptr, nullptr, nullptr); + GetBlindingData(mapValueInd, rangeproof, reissuance_token ? issuance.nInflationKeys : issuance.nAmount, CConfidentialAsset(asset), CConfidentialNonce(), blindingScript, nullptr, &ret, nullptr, nullptr, nullptr); return ret; } diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 71524f3dde..86a726dfb4 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -533,6 +533,8 @@ class CWalletTx : public CMerkleTx uint256 GetOutputAssetBlindingFactor(unsigned int output_index) const; //! Returns the underlying asset type, or 0 if unknown CAsset GetOutputAsset(unsigned int output_index) const; + //! Get the issuance CAssets for both the asset itself and the issuing tokens + void GetIssuanceAssets(unsigned int vinIndex, CAsset* out_asset, CAsset* out_reissuance_token) const; // ! Returns receiver's blinding pubkey CPubKey GetOutputBlindingPubKey(unsigned int output_index) const; //! Get the issuance blinder for either the asset itself or the issuing tokens From 51e789722f641202d8f41c77916dd55b20f7cdab Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sat, 15 Dec 2018 22:07:28 +0000 Subject: [PATCH 12/97] GUI: TransactionRecord: Add asset issuance record type --- src/interfaces/wallet.cpp | 8 +++++++- src/interfaces/wallet.h | 4 ++++ src/qt/transactionrecord.cpp | 19 ++++++++++++++++++- src/qt/transactionrecord.h | 3 ++- src/qt/transactiontablemodel.cpp | 5 +++++ src/qt/transactionview.cpp | 1 + 6 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index 496d83f435..33185c297d 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -61,8 +61,14 @@ static WalletTx MakeWalletTx(CWallet& wallet, const CWalletTx& wtx) EXCLUSIVE_LO WalletTx result; result.tx = wtx.tx; result.txin_is_mine.reserve(wtx.tx->vin.size()); - for (const auto& txin : wtx.tx->vin) { + result.txin_issuance_asset.resize(wtx.tx->vin.size()); + result.txin_issuance_token.resize(wtx.tx->vin.size()); + for (unsigned int i = 0; i < wtx.tx->vin.size(); ++i) { + const auto& txin = wtx.tx->vin[i]; result.txin_is_mine.emplace_back(wallet.IsMine(txin)); + wtx.GetIssuanceAssets(i, &result.txin_issuance_asset[i], &result.txin_issuance_token[i]); + result.txin_issuance_asset_amount.emplace_back(wtx.GetIssuanceAmount(i, false)); + result.txin_issuance_token_amount.emplace_back(wtx.GetIssuanceAmount(i, true)); } result.txout_is_mine.reserve(wtx.tx->vout.size()); result.txout_address.reserve(wtx.tx->vout.size()); diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index ca7c104c93..87d1891863 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -337,6 +337,10 @@ struct WalletTx std::vector txout_address_is_mine; std::vector txout_amounts; std::vector txout_assets; + std::vector txin_issuance_asset_amount; + std::vector txin_issuance_asset; + std::vector txin_issuance_token_amount; + std::vector txin_issuance_token; CAmountMap credit; CAmountMap debit; CAmountMap change; diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 9663c72bbd..51365d16d1 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -80,10 +80,27 @@ QList TransactionRecord::decomposeTransaction(const interface { bool involvesWatchAddress = false; isminetype fAllFromMe = ISMINE_SPENDABLE; - for (const isminetype mine : wtx.txin_is_mine) + for (size_t i = 0; i < wtx.tx->vin.size(); ++i) { + isminetype mine = wtx.txin_is_mine[i]; if(mine & ISMINE_WATCH_ONLY) involvesWatchAddress = true; if(fAllFromMe > mine) fAllFromMe = mine; + if (!wtx.txin_issuance_asset[i].IsNull()) { + TransactionRecord sub(hash, nTime); + sub.involvesWatchAddress = involvesWatchAddress; + sub.asset = wtx.txin_issuance_asset[i]; + sub.amount = wtx.txin_issuance_asset_amount[i]; + sub.type = TransactionRecord::IssuedAsset; + parts.append(sub); + } + if (!wtx.txin_issuance_token[i].IsNull()) { + TransactionRecord sub(hash, nTime); + sub.involvesWatchAddress = involvesWatchAddress; + sub.asset = wtx.txin_issuance_token[i]; + sub.amount = wtx.txin_issuance_token_amount[i]; + sub.type = TransactionRecord::IssuedAsset; + parts.append(sub); + } } isminetype fAllToMe = ISMINE_SPENDABLE; diff --git a/src/qt/transactionrecord.h b/src/qt/transactionrecord.h index ee087e5b11..9fdb5b6a65 100644 --- a/src/qt/transactionrecord.h +++ b/src/qt/transactionrecord.h @@ -83,7 +83,8 @@ class TransactionRecord RecvWithAddress, RecvFromOther, SendToSelf, - Fee + Fee, + IssuedAsset, }; /** Number of confirmation recommended for accepting a transaction */ diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index f09c0864d9..c538f6c25e 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -354,6 +354,8 @@ QString TransactionTableModel::formatTxType(const TransactionRecord *wtx) const return tr("Mined"); case TransactionRecord::Fee: return tr("Fee"); + case TransactionRecord::IssuedAsset: + return tr("Issuance"); default: return QString(); } @@ -364,6 +366,7 @@ QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord *wtx switch(wtx->type) { case TransactionRecord::Generated: + case TransactionRecord::IssuedAsset: return QIcon(":/icons/tx_mined"); case TransactionRecord::RecvWithAddress: case TransactionRecord::RecvFromOther: @@ -392,6 +395,7 @@ QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, b case TransactionRecord::RecvWithAddress: case TransactionRecord::SendToAddress: case TransactionRecord::Generated: + case TransactionRecord::IssuedAsset: return lookupAddress(wtx->address, tooltip) + watchAddress; case TransactionRecord::SendToOther: return QString::fromStdString(wtx->address) + watchAddress; @@ -409,6 +413,7 @@ QVariant TransactionTableModel::addressColor(const TransactionRecord *wtx) const case TransactionRecord::RecvWithAddress: case TransactionRecord::SendToAddress: case TransactionRecord::Generated: + case TransactionRecord::IssuedAsset: { QString label = walletModel->getAddressTableModel()->labelForAddress(QString::fromStdString(wtx->address)); if(label.isEmpty()) diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index ea8883e6ce..b67cfe7f73 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -125,6 +125,7 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa typeWidget->addItem(tr("To yourself"), TransactionFilterProxy::TYPE(TransactionRecord::SendToSelf)); typeWidget->addItem(tr("Mined"), TransactionFilterProxy::TYPE(TransactionRecord::Generated)); typeWidget->addItem(tr("Fee"), TransactionFilterProxy::TYPE(TransactionRecord::Fee)); + typeWidget->addItem(tr("Issuance"), TransactionFilterProxy::TYPE(TransactionRecord::IssuedAsset)); typeWidget->addItem(tr("Other"), TransactionFilterProxy::TYPE(TransactionRecord::Other)); hlayout->addWidget(typeWidget); From 4ea8f8827493283544aff40bca723583610d0d94 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sat, 15 Dec 2018 22:49:26 +0000 Subject: [PATCH 13/97] GUI: TransactionRecord: When time/index/etc match, sort fee, issuance, send, then receive --- src/qt/transactionrecord.cpp | 25 +++++++++++++++++++++++-- src/qt/transactiontablemodel.cpp | 2 +- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 51365d16d1..dbae32708c 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -189,11 +189,32 @@ void TransactionRecord::updateStatus(const interfaces::WalletTxStatus& wtx, int // Determine transaction status // Sort order, unrecorded transactions sort to the top - status.sortKey = strprintf("%010d-%01d-%010u-%03d", + int typesort; + switch (type) { + case Fee: + typesort = 0; + break; + case IssuedAsset: + typesort = 1; + break; + case SendToAddress: + case SendToOther: + case SendToSelf: + typesort = 2; + break; + case RecvWithAddress: + case RecvFromOther: + typesort = 3; + break; + default: + typesort = 10; + } + status.sortKey = strprintf("%010d-%01d-%010u-%03d-%d", wtx.block_height, wtx.is_coinbase ? 1 : 0, wtx.time_received, - idx); + idx, + typesort); status.countsForBalance = wtx.is_trusted && !(wtx.blocks_to_maturity > 0); status.depth = wtx.depth_in_main_chain; status.cur_num_blocks = numBlocks; diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index c538f6c25e..5fbffcf691 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -554,7 +554,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const case Status: return QString::fromStdString(rec->status.sortKey); case Date: - return rec->time; + return QString::fromStdString(strprintf("%020-%s", rec->time, rec->status.sortKey)); case Type: return formatTxType(rec); case Watchonly: From 906cc4c40b01441d80bee3581ee3cb190d38716c Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sat, 15 Dec 2018 23:00:29 +0000 Subject: [PATCH 14/97] Wallet: GetIssuanceAssets to get CAmountMap for issuances --- src/wallet/wallet.cpp | 21 +++++++++++++++++---- src/wallet/wallet.h | 2 ++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 5e85c671cc..f1fdedcd37 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2024,6 +2024,19 @@ bool CWalletTx::IsEquivalentTo(const CWalletTx& _tx) const return CTransaction(tx1) == CTransaction(tx2); } +CAmountMap CWalletTx::GetIssuanceAssets(unsigned int input_index) const { + CAmountMap ret; + CAsset asset, token; + GetIssuanceAssets(input_index, &asset, &token); + if (!asset.IsNull()) { + ret[asset] = GetIssuanceAmount(input_index, false); + } + if (!token.IsNull()) { + ret[token] = GetIssuanceAmount(input_index, true); + } + return ret; +} + std::vector CWallet::ResendWalletTransactionsBefore(int64_t nTime, CConnman* connman) { std::vector result; @@ -5196,9 +5209,9 @@ CPubKey CWalletTx::GetOutputBlindingPubKey(unsigned int output_index) const { return ret; } -void CWalletTx::GetIssuanceAssets(unsigned int vinIndex, CAsset* out_asset, CAsset* out_reissuance_token) const { - assert(vinIndex < tx->vin.size()); - const CAssetIssuance& issuance = tx->vin[vinIndex].assetIssuance; +void CWalletTx::GetIssuanceAssets(unsigned int input_index, CAsset* out_asset, CAsset* out_reissuance_token) const { + assert(input_index < tx->vin.size()); + const CAssetIssuance& issuance = tx->vin[input_index].assetIssuance; if (out_asset && issuance.nAmount.IsNull()) { out_asset->SetNull(); @@ -5212,7 +5225,7 @@ void CWalletTx::GetIssuanceAssets(unsigned int vinIndex, CAsset* out_asset, CAss if (issuance.assetBlindingNonce.IsNull()) { uint256 entropy; - GenerateAssetEntropy(entropy, tx->vin[vinIndex].prevout, issuance.assetEntropy); + GenerateAssetEntropy(entropy, tx->vin[input_index].prevout, issuance.assetEntropy); if (out_reissuance_token) { CalculateReissuanceToken(*out_reissuance_token, entropy, issuance.nAmount.IsCommitment()); } diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 86a726dfb4..87d22bc346 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -535,6 +535,8 @@ class CWalletTx : public CMerkleTx CAsset GetOutputAsset(unsigned int output_index) const; //! Get the issuance CAssets for both the asset itself and the issuing tokens void GetIssuanceAssets(unsigned int vinIndex, CAsset* out_asset, CAsset* out_reissuance_token) const; + // ! Return map of issued assets at input_index + CAmountMap GetIssuanceAssets(unsigned int input_index) const; // ! Returns receiver's blinding pubkey CPubKey GetOutputBlindingPubKey(unsigned int output_index) const; //! Get the issuance blinder for either the asset itself or the issuing tokens From 89275ebf21bd05161bfe9236de0bf313880d3a6e Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sat, 15 Dec 2018 23:06:54 +0000 Subject: [PATCH 15/97] GUI: TransactionRecord: Special-case the common scenario where assets are simply issued to myself --- src/qt/transactionrecord.cpp | 67 +++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 4 deletions(-) diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index dbae32708c..8d39b5dcc0 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -80,19 +80,67 @@ QList TransactionRecord::decomposeTransaction(const interface { bool involvesWatchAddress = false; isminetype fAllFromMe = ISMINE_SPENDABLE; + std::set assets_issued_to_me_only; + CAmountMap assets_received_by_me_only; + for (unsigned int i = 0; i < wtx.tx->vout.size(); i++) + { + const CAsset& asset = wtx.txout_assets[i]; + if (assets_received_by_me_only.count(asset) && assets_received_by_me_only.at(asset) < 0) { + // Already known to be received by not-me + continue; + } + isminetype mine = wtx.txout_address_is_mine[i]; + if (!mine) { + assets_received_by_me_only[asset] = -1; + } else { + assets_received_by_me_only[asset] += wtx.txout_amounts[i]; + } + } + for (size_t i = 0; i < wtx.tx->vin.size(); ++i) { isminetype mine = wtx.txin_is_mine[i]; if(mine & ISMINE_WATCH_ONLY) involvesWatchAddress = true; if(fAllFromMe > mine) fAllFromMe = mine; - if (!wtx.txin_issuance_asset[i].IsNull()) { + const CAsset& asset = wtx.txin_issuance_asset[i]; + const CAmount& asset_amount = wtx.txin_issuance_asset_amount[i]; + const CAsset& token = wtx.txin_issuance_token[i]; + const CAmount& token_amount = wtx.txin_issuance_token_amount[i]; + if (!asset.IsNull()) { + if (assets_received_by_me_only.count(asset) == 0) { + continue; + } + if (asset_amount == assets_received_by_me_only.at(asset)) { + // Special case: collapse the chain of issue, send, receive to just an issue + assets_issued_to_me_only.insert(asset); + continue; + } + + TransactionRecord sub(hash, nTime); + sub.involvesWatchAddress = involvesWatchAddress; + sub.asset = asset; + sub.amount = asset_amount; + sub.type = TransactionRecord::IssuedAsset; + parts.append(sub); + } + if (!token.IsNull()) { + if (assets_received_by_me_only.count(token) == 0) { + continue; + } + if (token_amount == assets_received_by_me_only.at(asset)) { + // Special case: collapse the chain of issue, send, receive to just an issue + assets_issued_to_me_only.insert(asset); + continue; + } + TransactionRecord sub(hash, nTime); sub.involvesWatchAddress = involvesWatchAddress; - sub.asset = wtx.txin_issuance_asset[i]; - sub.amount = wtx.txin_issuance_asset_amount[i]; + sub.asset = token; + sub.amount = token_amount; sub.type = TransactionRecord::IssuedAsset; parts.append(sub); } + if (!wtx.txin_issuance_token[i].IsNull()) { TransactionRecord sub(hash, nTime); sub.involvesWatchAddress = involvesWatchAddress; @@ -126,13 +174,16 @@ QList TransactionRecord::decomposeTransaction(const interface } else if (fAllFromMe) { + // // Debit // for (unsigned int nOut = 0; nOut < wtx.tx->vout.size(); nOut++) { + const CTxOut& txout = wtx.tx->vout[nOut]; + const CAsset& asset = wtx.txout_assets[nOut]; if(wtx.txout_is_mine[nOut] || txout.IsFee()) { @@ -141,11 +192,16 @@ QList TransactionRecord::decomposeTransaction(const interface continue; } + // Short-circuit when it's an issuance to self + if (assets_issued_to_me_only.count(asset) == 0) { + continue; + } + TransactionRecord sub(hash, nTime); sub.idx = nOut; sub.involvesWatchAddress = involvesWatchAddress; sub.amount = -wtx.txout_amounts[nOut]; - sub.asset = wtx.txout_assets[nOut]; + sub.asset = asset; if (!boost::get(&wtx.txout_address[nOut])) { @@ -159,6 +215,9 @@ QList TransactionRecord::decomposeTransaction(const interface sub.type = TransactionRecord::SendToOther; sub.address = mapValue["to"]; } + if (assets_issued_to_me_only.count(asset)) { + sub.type = TransactionRecord::IssuedAsset; + } parts.append(sub); } From 988ed5effc4542cf0fa1f033ff78cd57c9742904 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sun, 16 Dec 2018 04:20:46 +0000 Subject: [PATCH 16/97] GUI: Abstract asset+amount formatting into new GUIUtil::formatAssetAmount --- src/qt/guiutil.cpp | 21 +++++++++++++++++++++ src/qt/guiutil.h | 5 +++++ src/qt/transactiontablemodel.cpp | 17 +---------------- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 77d99ad307..bdd0968a8a 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -11,6 +11,7 @@ #include #include +#include "assetsdir.h" #include #include #include @@ -773,6 +774,26 @@ QString boostPathToQString(const fs::path &path) return QString::fromStdString(path.string(utf8)); } +QString formatAssetAmount(const CAsset& asset, const CAmount& amount, const int bitcoin_unit, BitcoinUnits::SeparatorStyle separators) +{ + if (asset == Params().GetConsensus().pegged_asset) { + return BitcoinUnits::formatWithUnit(bitcoin_unit, amount, false, separators); + } + + qlonglong whole = amount / 100000000; + qlonglong fraction = amount % 100000000; + QString str = QString("%1").arg(whole); + if (fraction) { + str += QString(".%1").arg(fraction, 8, 10, QLatin1Char('0')); + } + std::string asset_label = gAssetsDir.GetLabel(asset); + if (asset_label.empty()) { + asset_label = asset.GetHex(); + } + str += QString(" ") + QString::fromStdString(asset_label); + return str; +} + QString formatDurationStr(int secs) { QStringList strList; diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index 011827e134..f22a85b136 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -7,6 +7,8 @@ #include #include +#include "bitcoinunits.h" +#include #include #include @@ -187,6 +189,9 @@ namespace GUIUtil /* Convert OS specific boost path to QString through UTF-8 */ QString boostPathToQString(const fs::path &path); + /* Format an amount of assets in a user-friendly style */ + QString formatAssetAmount(const CAsset&, const CAmount&, int bitcoin_unit, BitcoinUnits::SeparatorStyle); + /* Convert seconds into a QString with days, hours, mins, secs */ QString formatDurationStr(int secs); diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 5fbffcf691..5a423e77e8 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -429,22 +429,7 @@ QVariant TransactionTableModel::addressColor(const TransactionRecord *wtx) const QString TransactionTableModel::formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed, BitcoinUnits::SeparatorStyle separators) const { - QString str; - if (wtx->asset == ::policyAsset) { - str = BitcoinUnits::formatWithUnit(walletModel->getOptionsModel()->getDisplayUnit(), wtx->amount, false, separators); - } else { - qlonglong whole = wtx->amount / 100000000; - qlonglong fraction = wtx->amount % 100000000; - str = QString("%1").arg(whole); - if (fraction) { - str += QString(".%1").arg(fraction, 8, 10, QLatin1Char('0')); - } - std::string asset_label = gAssetsDir.GetLabel(wtx->asset); - if (asset_label.empty()) { - asset_label = wtx->asset.GetHex(); - } - str += QString(" ") + QString::fromStdString(asset_label); - } + QString str = GUIUtil::formatAssetAmount(wtx->asset, wtx->amount, walletModel->getOptionsModel()->getDisplayUnit(), separators); if(showUnconfirmed) { if(!wtx->status.countsForBalance) From 6342d80d7f68e39664cdffc92afccb4bd647d8da Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sun, 16 Dec 2018 04:31:39 +0000 Subject: [PATCH 17/97] GUI: Add GUIUtil::formatMultiAssetAmount to handle a CAmountMap --- src/qt/guiutil.cpp | 20 ++++++++++++++++++++ src/qt/guiutil.h | 3 +++ 2 files changed, 23 insertions(+) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index bdd0968a8a..4e5b5e3ac2 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -794,6 +794,26 @@ QString formatAssetAmount(const CAsset& asset, const CAmount& amount, const int return str; } +QString formatMultiAssetAmount(const CAmountMap& amountmap, const int bitcoin_unit, BitcoinUnits::SeparatorStyle separators, QString line_separator) +{ + QStringList ret; + if (amountmap.count(Params().GetConsensus().pegged_asset) && amountmap.at(Params().GetConsensus().pegged_asset)) { + ret << formatAssetAmount(Params().GetConsensus().pegged_asset, amountmap.at(Params().GetConsensus().pegged_asset), bitcoin_unit, separators); + } + for (const auto& assetamount : amountmap) { + if (assetamount.first == Params().GetConsensus().pegged_asset) { + // Already handled first + continue; + } + if (!assetamount.second) { + // Don't include zero-amount assets + continue; + } + ret << formatAssetAmount(assetamount.first, assetamount.second, bitcoin_unit, separators); + } + return ret.join(line_separator); +} + QString formatDurationStr(int secs) { QStringList strList; diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index f22a85b136..d11e3ca6dd 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -192,6 +192,9 @@ namespace GUIUtil /* Format an amount of assets in a user-friendly style */ QString formatAssetAmount(const CAsset&, const CAmount&, int bitcoin_unit, BitcoinUnits::SeparatorStyle); + /* Format one or more asset+amounts in a user-friendly style */ + QString formatMultiAssetAmount(const CAmountMap&, int bitcoin_unit, BitcoinUnits::SeparatorStyle, QString line_separator); + /* Convert seconds into a QString with days, hours, mins, secs */ QString formatDurationStr(int secs); From f5fb840cdbeaab84d51f032f1b68d7ffe0e25b2f Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sun, 16 Dec 2018 04:55:24 +0000 Subject: [PATCH 18/97] GUI: Overview: Show all assets in balances --- src/qt/forms/overviewpage.ui | 12 ++++++++++++ src/qt/overviewpage.cpp | 20 ++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/qt/forms/overviewpage.ui b/src/qt/forms/overviewpage.ui index 710801ee96..5bad949f7b 100644 --- a/src/qt/forms/overviewpage.ui +++ b/src/qt/forms/overviewpage.ui @@ -220,6 +220,9 @@ Total: + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + @@ -265,6 +268,9 @@ Immature: + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + @@ -332,6 +338,9 @@ Available: + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + @@ -389,6 +398,9 @@ Pending: + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 12fda181ca..2f3f3e5ec6 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -159,19 +159,19 @@ void OverviewPage::setBalance(const interfaces::WalletBalances& balances) { int unit = walletModel->getOptionsModel()->getDisplayUnit(); m_balances = balances; - 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)); + ui->labelBalance->setText(GUIUtil::formatMultiAssetAmount(balances.balance, unit, BitcoinUnits::separatorAlways, "\n")); + ui->labelUnconfirmed->setText(GUIUtil::formatMultiAssetAmount(balances.unconfirmed_balance, unit, BitcoinUnits::separatorAlways, "\n")); + ui->labelImmature->setText(GUIUtil::formatMultiAssetAmount(balances.immature_balance, unit, BitcoinUnits::separatorAlways, "\n")); + ui->labelTotal->setText(GUIUtil::formatMultiAssetAmount(balances.balance + balances.unconfirmed_balance + balances.immature_balance, unit, BitcoinUnits::separatorAlways, "\n")); + ui->labelWatchAvailable->setText(GUIUtil::formatMultiAssetAmount(balances.watch_only_balance, unit, BitcoinUnits::separatorAlways, "\n")); + ui->labelWatchPending->setText(GUIUtil::formatMultiAssetAmount(balances.unconfirmed_watch_only_balance, unit, BitcoinUnits::separatorAlways, "\n")); + ui->labelWatchImmature->setText(GUIUtil::formatMultiAssetAmount(balances.immature_watch_only_balance, unit, BitcoinUnits::separatorAlways, "\n")); + ui->labelWatchTotal->setText(GUIUtil::formatMultiAssetAmount(balances.watch_only_balance + balances.unconfirmed_watch_only_balance + balances.immature_watch_only_balance, unit, BitcoinUnits::separatorAlways, "\n")); // only show immature (newly mined) balance if it's non-zero, so as not to complicate things // for the non-mining users - bool showImmature = valueFor(balances.immature_balance, ::policyAsset) != 0; - bool showWatchOnlyImmature = valueFor(balances.immature_watch_only_balance, ::policyAsset) != 0; + bool showImmature = !balances.immature_balance.empty(); + bool showWatchOnlyImmature = !balances.immature_watch_only_balance.empty(); // for symmetry reasons also show immature label when the watch-only one is shown ui->labelImmature->setVisible(showImmature || showWatchOnlyImmature); From f027ca0c64bbc6f003098b8150bb07ebc23c0cb5 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sun, 16 Dec 2018 04:56:03 +0000 Subject: [PATCH 19/97] GUI: Always include bitcoins in formatMultiAssetAmount --- src/qt/guiutil.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 4e5b5e3ac2..89789bac35 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -797,9 +797,7 @@ QString formatAssetAmount(const CAsset& asset, const CAmount& amount, const int QString formatMultiAssetAmount(const CAmountMap& amountmap, const int bitcoin_unit, BitcoinUnits::SeparatorStyle separators, QString line_separator) { QStringList ret; - if (amountmap.count(Params().GetConsensus().pegged_asset) && amountmap.at(Params().GetConsensus().pegged_asset)) { - ret << formatAssetAmount(Params().GetConsensus().pegged_asset, amountmap.at(Params().GetConsensus().pegged_asset), bitcoin_unit, separators); - } + ret << formatAssetAmount(Params().GetConsensus().pegged_asset, amountmap.count(Params().GetConsensus().pegged_asset) ? amountmap.at(Params().GetConsensus().pegged_asset) : 0, bitcoin_unit, separators); for (const auto& assetamount : amountmap) { if (assetamount.first == Params().GetConsensus().pegged_asset) { // Already handled first From 85f0ad80d65098d929135f455061805911930232 Mon Sep 17 00:00:00 2001 From: Lawrence Nahum Date: Tue, 18 Dec 2018 02:53:54 +0100 Subject: [PATCH 20/97] replace bitcoin-qt with elements-qt --- .gitignore | 4 +-- CONTRIBUTING.md | 2 +- Makefile.am | 4 +-- contrib/macdeploy/detached-sig-create.sh | 2 +- contrib/macdeploy/fancy.plist | 2 +- contrib/macdeploy/macdeployqtplus | 4 +-- doc/README.md | 4 +-- doc/README_windows.txt | 2 +- doc/build-unix.md | 6 ++--- share/qt/Info.plist.in | 6 ++--- src/Makefile.qt.include | 32 ++++++++++++------------ src/Makefile.qttest.include | 32 ++++++++++++------------ src/qt/Makefile | 10 ++++---- src/qt/guiconstants.h | 4 +-- src/qt/macnotificationhandler.mm | 2 +- src/qt/res/bitcoin-qt-res.rc | 4 +-- src/qt/test/test_main.cpp | 2 +- src/qt/utilitydialog.cpp | 2 +- 18 files changed, 62 insertions(+), 62 deletions(-) diff --git a/.gitignore b/.gitignore index b32e317f3a..d8b2a20067 100644 --- a/.gitignore +++ b/.gitignore @@ -80,8 +80,8 @@ src/qt/bitcoin-qt.includes # Compilation and Qt preprocessor part *.qm Makefile -bitcoin-qt -Bitcoin-Qt.app +elements-qt +Elements-Qt.app background.tiff* # Unit-tests diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3d5dc3221b..a688b3dd82 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -78,7 +78,7 @@ the pull request affects. Valid areas as: - *Consensus* for changes to consensus critical code - *Docs* for changes to the documentation - - *Qt* for changes to bitcoin-qt + - *Qt* for changes to elements-qt - *Mining* for changes to the mining code - *Net* or *P2P* for changes to the peer-to-peer network code - *RPC/REST/ZMQ* for changes to the RPC, REST or ZMQ APIs diff --git a/Makefile.am b/Makefile.am index 291e09c535..f668b9e071 100644 --- a/Makefile.am +++ b/Makefile.am @@ -129,7 +129,7 @@ $(APP_DIST_DIR)/Applications: @rm -f $@ @cd $(@D); $(LN_S) /Applications $(@F) -$(APP_DIST_EXTRAS): $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt +$(APP_DIST_EXTRAS): $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Elements-Qt $(OSX_DMG): $(APP_DIST_EXTRAS) $(GENISOIMAGE) -no-cache-inodes -D -l -probe -V "$(OSX_VOLNAME)" -no-pad -r -dir-mode 0755 -apple -o $@ dist @@ -144,7 +144,7 @@ $(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE): $(OSX_BACKGROUND_IMAGE_DPIF $(APP_DIST_DIR)/.DS_Store: $(OSX_DSSTORE_GEN) $(PYTHON) $< "$@" "$(OSX_VOLNAME)" -$(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING) +$(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Elements-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING) INSTALLNAMETOOL=$(INSTALLNAMETOOL) OTOOL=$(OTOOL) STRIP=$(STRIP) $(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -translations-dir=$(QT_TRANSLATION_DIR) -add-qt-tr $(OSX_QT_TRANSLATIONS) -verbose 2 deploydir: $(APP_DIST_EXTRAS) diff --git a/contrib/macdeploy/detached-sig-create.sh b/contrib/macdeploy/detached-sig-create.sh index 5281ebcc47..fd467e3f1e 100755 --- a/contrib/macdeploy/detached-sig-create.sh +++ b/contrib/macdeploy/detached-sig-create.sh @@ -7,7 +7,7 @@ export LC_ALL=C set -e ROOTDIR=dist -BUNDLE="${ROOTDIR}/Bitcoin-Qt.app" +BUNDLE="${ROOTDIR}/Elements-Qt.app" CODESIGN=codesign TEMPDIR=sign.temp TEMPLIST=${TEMPDIR}/signatures.txt diff --git a/contrib/macdeploy/fancy.plist b/contrib/macdeploy/fancy.plist index ef277a7f14..3491d6c53a 100644 --- a/contrib/macdeploy/fancy.plist +++ b/contrib/macdeploy/fancy.plist @@ -22,7 +22,7 @@ 370 156 - Bitcoin-Qt.app + Elements-Qt.app 128 156 diff --git a/contrib/macdeploy/macdeployqtplus b/contrib/macdeploy/macdeployqtplus index 17ce6c44f9..2df26bfb99 100755 --- a/contrib/macdeploy/macdeployqtplus +++ b/contrib/macdeploy/macdeployqtplus @@ -154,7 +154,7 @@ class FrameworkInfo(object): class ApplicationBundleInfo(object): def __init__(self, path): self.path = path - appName = "Bitcoin-Qt" + appName = "Elements-Qt" self.binaryPath = os.path.join(path, "Contents", "MacOS", appName) if not os.path.exists(self.binaryPath): raise RuntimeError("Could not find bundle binary for " + path) @@ -602,7 +602,7 @@ else: # ------------------------------------------------ -target = os.path.join("dist", "Bitcoin-Qt.app") +target = os.path.join("dist", "Elements-Qt.app") if verbose >= 2: print("+ Copying source bundle +") diff --git a/doc/README.md b/doc/README.md index 499c0b1459..e4d0f04c55 100644 --- a/doc/README.md +++ b/doc/README.md @@ -16,11 +16,11 @@ The following are some helpful notes on how to run Bitcoin Core on your native p Unpack the files into a directory and run: - `bin/elementsd` (headless) -- `bin/elements-qt` (GUI) (currently not provided) +- `bin/elements-qt` (GUI) ### Windows -Unpack the files into a directory, and then run bitcoin-qt.exe. +Unpack the files into a directory, and then run elements-qt.exe. ### macOS diff --git a/doc/README_windows.txt b/doc/README_windows.txt index 07d61b3bda..adc1d8ff6c 100644 --- a/doc/README_windows.txt +++ b/doc/README_windows.txt @@ -11,7 +11,7 @@ with each other, with the help of a P2P network to check for double-spending. Setup ----- -Unpack the files into a directory and run bitcoin-qt.exe. +Unpack the files into a directory and run elements-qt.exe. Bitcoin Core is the original Bitcoin client and it builds the backbone of the network. However, it downloads and stores the entire history of Bitcoin transactions; diff --git a/doc/build-unix.md b/doc/build-unix.md index d30cb02062..bd25d86349 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -24,7 +24,7 @@ make make install # optional ``` -This will build bitcoin-qt as well if the dependencies are met. +This will build elements-qt as well if the dependencies are met. Dependencies --------------------- @@ -99,7 +99,7 @@ ZMQ dependencies (provides ZMQ API 4.x): #### Dependencies for the GUI -If you want to build bitcoin-qt, make sure that the required packages for Qt development +If you want to build Elements-Qt, make sure that the required packages for Qt development are installed. Qt 5 is necessary to build the GUI. To build without GUI pass `--without-gui`. @@ -111,7 +111,7 @@ libqrencode (optional) can be installed with: sudo apt-get install libqrencode-dev -Once these are installed, they will be found by configure and a bitcoin-qt executable will be +Once these are installed, they will be found by configure and a elements-qt executable will be built by default. diff --git a/share/qt/Info.plist.in b/share/qt/Info.plist.in index 17b4ee47de..bb31afe4aa 100644 --- a/share/qt/Info.plist.in +++ b/share/qt/Info.plist.in @@ -29,16 +29,16 @@ ???? CFBundleExecutable - Bitcoin-Qt + Elements-Qt CFBundleName - Bitcoin-Qt + Elements-Qt LSHasLocalizedDisplayName CFBundleIdentifier - org.bitcoinfoundation.Bitcoin-Qt + org.elementsproject.Elements-Qt CFBundleURLTypes diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index c7a1963135..039d1d4831 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -2,7 +2,7 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. -bin_PROGRAMS += qt/bitcoin-qt +bin_PROGRAMS += qt/elements-qt EXTRA_LIBRARIES += qt/libbitcoinqt.a # bitcoin qt core # @@ -382,7 +382,7 @@ QT_FORMS_H=$(join $(dir $(QT_FORMS_UI)),$(addprefix ui_, $(notdir $(QT_FORMS_UI: # Most files will depend on the forms and moc files as includes. Generate them # before anything else. $(QT_MOC): $(QT_FORMS_H) -$(qt_libbitcoinqt_a_OBJECTS) $(qt_bitcoin_qt_OBJECTS) : | $(QT_MOC) +$(qt_libbitcoinqt_a_OBJECTS) $(qt_elements_qt_OBJECTS) : | $(QT_MOC) #Generating these with a half-written protobuf header leads to wacky results. #This makes sure it's done. @@ -390,29 +390,29 @@ $(QT_MOC): $(PROTOBUF_H) $(QT_MOC_CPP): $(PROTOBUF_H) # bitcoin-qt binary # -qt_bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \ +qt_elements_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \ $(QT_INCLUDES) $(PROTOBUF_CFLAGS) $(QR_CFLAGS) -qt_bitcoin_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS) +qt_elements_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS) -qt_bitcoin_qt_SOURCES = qt/bitcoin.cpp +qt_elements_qt_SOURCES = qt/bitcoin.cpp if TARGET_DARWIN - qt_bitcoin_qt_SOURCES += $(BITCOIN_MM) + qt_elements_qt_SOURCES += $(BITCOIN_MM) endif if TARGET_WINDOWS - qt_bitcoin_qt_SOURCES += $(BITCOIN_RC) + qt_elements_qt_SOURCES += $(BITCOIN_RC) endif -qt_bitcoin_qt_LDADD = qt/libbitcoinqt.a $(LIBBITCOIN_SERVER) +qt_elements_qt_LDADD = qt/libbitcoinqt.a $(LIBBITCOIN_SERVER) if ENABLE_WALLET -qt_bitcoin_qt_LDADD += $(LIBBITCOIN_UTIL) $(LIBBITCOIN_WALLET) +qt_elements_qt_LDADD += $(LIBBITCOIN_UTIL) $(LIBBITCOIN_WALLET) endif if ENABLE_ZMQ -qt_bitcoin_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS) +qt_elements_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS) endif -qt_bitcoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) \ +qt_elements_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBLEVELDB_SSE42) $(LIBMEMENV) \ $(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \ $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) -qt_bitcoin_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -qt_bitcoin_qt_LIBTOOLFLAGS = $(AM_LIBTOOLFLAGS) --tag CXX +qt_elements_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) +qt_elements_qt_LIBTOOLFLAGS = $(AM_LIBTOOLFLAGS) --tag CXX #locale/foo.ts -> locale/foo.qm QT_QM=$(QT_TS:.ts=.qm) @@ -443,10 +443,10 @@ CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda CLEANFILES += $(CLEAN_QT) -bitcoin_qt_clean: FORCE - rm -f $(CLEAN_QT) $(qt_libbitcoinqt_a_OBJECTS) $(qt_bitcoin_qt_OBJECTS) qt/bitcoin-qt$(EXEEXT) $(LIBBITCOINQT) +elements_qt_clean: FORCE + rm -f $(CLEAN_QT) $(qt_libbitcoinqt_a_OBJECTS) $(qt_elements_qt_OBJECTS) qt/elements-qt$(EXEEXT) $(LIBBITCOINQT) -bitcoin_qt : qt/bitcoin-qt$(EXEEXT) +elements_qt : qt/elements-qt$(EXEEXT) ui_%.h: %.ui @test -f $(UIC) diff --git a/src/Makefile.qttest.include b/src/Makefile.qttest.include index 4b14212b2e..2849ada759 100644 --- a/src/Makefile.qttest.include +++ b/src/Makefile.qttest.include @@ -2,8 +2,8 @@ # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. -bin_PROGRAMS += qt/test/test_bitcoin-qt -TESTS += qt/test/test_bitcoin-qt +bin_PROGRAMS += qt/test/test_elements-qt +TESTS += qt/test/test_elements-qt TEST_QT_MOC_CPP = \ qt/test/moc_compattests.cpp \ @@ -33,10 +33,10 @@ TEST_BITCOIN_CPP = \ TEST_BITCOIN_H = \ test/test_bitcoin.h -qt_test_test_bitcoin_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \ +qt_test_test_elements_qt_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \ $(QT_INCLUDES) $(QT_TEST_INCLUDES) $(PROTOBUF_CFLAGS) -qt_test_test_bitcoin_qt_SOURCES = \ +qt_test_test_elements_qt_SOURCES = \ qt/test/compattests.cpp \ qt/test/rpcnestedtests.cpp \ qt/test/test_main.cpp \ @@ -46,37 +46,37 @@ qt_test_test_bitcoin_qt_SOURCES = \ $(TEST_BITCOIN_CPP) \ $(TEST_BITCOIN_H) if ENABLE_WALLET -qt_test_test_bitcoin_qt_SOURCES += \ +qt_test_test_elements_qt_SOURCES += \ qt/test/addressbooktests.cpp \ qt/test/paymentservertests.cpp \ qt/test/wallettests.cpp \ wallet/test/wallet_test_fixture.cpp endif -nodist_qt_test_test_bitcoin_qt_SOURCES = $(TEST_QT_MOC_CPP) +nodist_qt_test_test_elements_qt_SOURCES = $(TEST_QT_MOC_CPP) -qt_test_test_bitcoin_qt_LDADD = $(LIBBITCOINQT) $(LIBBITCOIN_SERVER) +qt_test_test_elements_qt_LDADD = $(LIBBITCOINQT) $(LIBBITCOIN_SERVER) if ENABLE_WALLET -qt_test_test_bitcoin_qt_LDADD += $(LIBBITCOIN_UTIL) $(LIBBITCOIN_WALLET) +qt_test_test_elements_qt_LDADD += $(LIBBITCOIN_UTIL) $(LIBBITCOIN_WALLET) endif if ENABLE_ZMQ -qt_test_test_bitcoin_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS) +qt_test_test_elements_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS) endif -qt_test_test_bitcoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) \ +qt_test_test_elements_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CONSENSUS) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) \ $(LIBLEVELDB_SSE42) $(LIBMEMENV) $(BOOST_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) $(QT_LIBS) \ $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) \ $(EVENT_PTHREADS_LIBS) $(EVENT_LIBS) -qt_test_test_bitcoin_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) -qt_test_test_bitcoin_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS) +qt_test_test_elements_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS) +qt_test_test_elements_qt_CXXFLAGS = $(AM_CXXFLAGS) $(QT_PIE_FLAGS) CLEAN_BITCOIN_QT_TEST = $(TEST_QT_MOC_CPP) qt/test/*.gcda qt/test/*.gcno CLEANFILES += $(CLEAN_BITCOIN_QT_TEST) -test_bitcoin_qt : qt/test/test_bitcoin-qt$(EXEEXT) +test_elements_qt : qt/test/test_elements-qt$(EXEEXT) -test_bitcoin_qt_check : qt/test/test_bitcoin-qt$(EXEEXT) FORCE +test_elements_qt_check : qt/test/test_elements-qt$(EXEEXT) FORCE $(MAKE) check-TESTS TESTS=$^ -test_bitcoin_qt_clean: FORCE - rm -f $(CLEAN_BITCOIN_QT_TEST) $(qt_test_test_bitcoin_qt_OBJECTS) +test_elements_qt_clean: FORCE + rm -f $(CLEAN_BITCOIN_QT_TEST) $(qt_test_test_elements_qt_OBJECTS) diff --git a/src/qt/Makefile b/src/qt/Makefile index b9dcf0c599..98647296ec 100644 --- a/src/qt/Makefile +++ b/src/qt/Makefile @@ -1,9 +1,9 @@ .PHONY: FORCE all: FORCE - $(MAKE) -C .. bitcoin_qt test_bitcoin_qt + $(MAKE) -C .. elements_qt test_elements_qt clean: FORCE - $(MAKE) -C .. bitcoin_qt_clean test_bitcoin_qt_clean + $(MAKE) -C .. elements_qt_clean test_elements_qt_clean check: FORCE - $(MAKE) -C .. test_bitcoin_qt_check -bitcoin-qt bitcoin-qt.exe: FORCE - $(MAKE) -C .. bitcoin_qt + $(MAKE) -C .. test_elements_qt_check +elements-qt elements-qt.exe: FORCE + $(MAKE) -C .. elements_qt diff --git a/src/qt/guiconstants.h b/src/qt/guiconstants.h index 04b03a5435..a25fa14d2f 100644 --- a/src/qt/guiconstants.h +++ b/src/qt/guiconstants.h @@ -48,7 +48,7 @@ static const int MAX_URI_LENGTH = 255; #define QAPP_ORG_NAME "Bitcoin" #define QAPP_ORG_DOMAIN "bitcoin.org" -#define QAPP_APP_NAME_DEFAULT "Bitcoin-Qt" -#define QAPP_APP_NAME_TESTNET "Bitcoin-Qt-testnet" +#define QAPP_APP_NAME_DEFAULT "Elements-Qt" +#define QAPP_APP_NAME_TESTNET "Elements-Qt-testnet" #endif // BITCOIN_QT_GUICONSTANTS_H diff --git a/src/qt/macnotificationhandler.mm b/src/qt/macnotificationhandler.mm index 0e04d50baa..e0906a1c58 100644 --- a/src/qt/macnotificationhandler.mm +++ b/src/qt/macnotificationhandler.mm @@ -13,7 +13,7 @@ @implementation NSBundle(returnCorrectIdentifier) - (NSString *)__bundleIdentifier { if (self == [NSBundle mainBundle]) { - return @"org.bitcoinfoundation.Bitcoin-Qt"; + return @"org.elementsproject.Elements-Qt"; } else { return [self __bundleIdentifier]; } diff --git a/src/qt/res/bitcoin-qt-res.rc b/src/qt/res/bitcoin-qt-res.rc index 94ae256477..a915593f42 100644 --- a/src/qt/res/bitcoin-qt-res.rc +++ b/src/qt/res/bitcoin-qt-res.rc @@ -22,10 +22,10 @@ BEGIN VALUE "CompanyName", "Bitcoin" VALUE "FileDescription", PACKAGE_NAME " (GUI node for Bitcoin)" VALUE "FileVersion", VER_FILEVERSION_STR - VALUE "InternalName", "bitcoin-qt" + VALUE "InternalName", "elements-qt" VALUE "LegalCopyright", COPYRIGHT_STR VALUE "LegalTrademarks1", "Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php." - VALUE "OriginalFilename", "bitcoin-qt.exe" + VALUE "OriginalFilename", "elements-qt.exe" VALUE "ProductName", PACKAGE_NAME VALUE "ProductVersion", VER_PRODUCTVERSION_STR END diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp index df65a85fb5..82f3118f01 100644 --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) // Don't remove this, it's needed to access // QApplication:: and QCoreApplication:: in the tests QApplication app(argc, argv); - app.setApplicationName("Bitcoin-Qt-test"); + app.setApplicationName("Elements-Qt-test"); SSL_library_init(); diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp index 7d903b3b1c..9cef3e703a 100644 --- a/src/qt/utilitydialog.cpp +++ b/src/qt/utilitydialog.cpp @@ -70,7 +70,7 @@ HelpMessageDialog::HelpMessageDialog(interfaces::Node& node, QWidget *parent, bo ui->helpMessage->setVisible(false); } else { setWindowTitle(tr("Command-line options")); - QString header = "Usage: bitcoin-qt [command-line options] \n"; + QString header = "Usage: elements-qt [command-line options] \n"; QTextCursor cursor(ui->helpMessage->document()); cursor.insertText(version); cursor.insertBlock(); From 2953613489500f0b4833bd1eaa111761ffbcb881 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 17 Dec 2018 19:12:06 +0000 Subject: [PATCH 21/97] GUI: Option to remove asset name for GUIUtil::formatAssetAmount --- src/qt/guiutil.cpp | 12 +++++++++--- src/qt/guiutil.h | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 89789bac35..f00d12bbec 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -774,10 +774,14 @@ QString boostPathToQString(const fs::path &path) return QString::fromStdString(path.string(utf8)); } -QString formatAssetAmount(const CAsset& asset, const CAmount& amount, const int bitcoin_unit, BitcoinUnits::SeparatorStyle separators) +QString formatAssetAmount(const CAsset& asset, const CAmount& amount, const int bitcoin_unit, BitcoinUnits::SeparatorStyle separators, bool include_asset_name) { if (asset == Params().GetConsensus().pegged_asset) { - return BitcoinUnits::formatWithUnit(bitcoin_unit, amount, false, separators); + if (include_asset_name) { + return BitcoinUnits::formatWithUnit(bitcoin_unit, amount, false, separators); + } else { + return BitcoinUnits::format(bitcoin_unit, amount, false, separators); + } } qlonglong whole = amount / 100000000; @@ -790,7 +794,9 @@ QString formatAssetAmount(const CAsset& asset, const CAmount& amount, const int if (asset_label.empty()) { asset_label = asset.GetHex(); } - str += QString(" ") + QString::fromStdString(asset_label); + if (include_asset_name) { + str += QString(" ") + QString::fromStdString(asset_label); + } return str; } diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index d11e3ca6dd..48ece311d7 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -190,7 +190,7 @@ namespace GUIUtil QString boostPathToQString(const fs::path &path); /* Format an amount of assets in a user-friendly style */ - QString formatAssetAmount(const CAsset&, const CAmount&, int bitcoin_unit, BitcoinUnits::SeparatorStyle); + QString formatAssetAmount(const CAsset&, const CAmount&, int bitcoin_unit, BitcoinUnits::SeparatorStyle, bool include_asset_name = true); /* Format one or more asset+amounts in a user-friendly style */ QString formatMultiAssetAmount(const CAmountMap&, int bitcoin_unit, BitcoinUnits::SeparatorStyle, QString line_separator); From d81c9f7b3e4e20b886b28d993d9b30c4fd331c81 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 4 Dec 2014 07:56:20 +0000 Subject: [PATCH 22/97] AmountSpinBox: Resolve singleStep default when making steps --- src/qt/bitcoinamountfield.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp index b68f3a439b..fb395eb763 100644 --- a/src/qt/bitcoinamountfield.cpp +++ b/src/qt/bitcoinamountfield.cpp @@ -25,7 +25,7 @@ class AmountSpinBox: public QAbstractSpinBox explicit AmountSpinBox(QWidget *parent): QAbstractSpinBox(parent), currentUnit(BitcoinUnits::BTC), - singleStep(100000) // satoshis + singleStep(0) { setAlignment(Qt::AlignRight); @@ -68,6 +68,10 @@ class AmountSpinBox: public QAbstractSpinBox { bool valid = false; CAmount val = value(&valid); + CAmount currentSingleStep = singleStep; + if (!currentSingleStep) { + currentSingleStep = 100000; // satoshis + } val = val + steps * singleStep; val = qMin(qMax(val, CAmount(0)), BitcoinUnits::maxMoney()); setValue(val); From 047799cb12773bad1015dd54ef59d459e2ac720a Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sun, 6 Jan 2019 05:53:13 +0000 Subject: [PATCH 23/97] CAsset: GetIdentifier to get label or hex id --- src/assetsdir.cpp | 7 +++++++ src/assetsdir.h | 3 +++ src/qt/guiutil.cpp | 6 +----- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/assetsdir.cpp b/src/assetsdir.cpp index 0b897828a3..8ac47edd47 100644 --- a/src/assetsdir.cpp +++ b/src/assetsdir.cpp @@ -72,6 +72,13 @@ std::string CAssetsDir::GetLabel(const CAsset& asset) const return GetMetadata(asset).GetLabel(); } +std::string CAssetsDir::GetIdentifier(const CAsset& asset) const +{ + const std::string label = GetMetadata(asset).GetLabel(); + if (!label.empty()) return label; + return asset.GetHex(); +} + std::vector CAssetsDir::GetKnownAssets() const { std::vector knownAssets; diff --git a/src/assetsdir.h b/src/assetsdir.h index 0c6e6814ca..798e5395f5 100644 --- a/src/assetsdir.h +++ b/src/assetsdir.h @@ -40,6 +40,9 @@ class CAssetsDir /** @return the label associated to the asset id */ std::string GetLabel(const CAsset& asset) const; + /** @return the label associated to the asset id, or some other identifier */ + std::string GetIdentifier(const CAsset& asset) const; + std::vector GetKnownAssets() const; }; diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index f00d12bbec..c76d301615 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -790,12 +790,8 @@ QString formatAssetAmount(const CAsset& asset, const CAmount& amount, const int if (fraction) { str += QString(".%1").arg(fraction, 8, 10, QLatin1Char('0')); } - std::string asset_label = gAssetsDir.GetLabel(asset); - if (asset_label.empty()) { - asset_label = asset.GetHex(); - } if (include_asset_name) { - str += QString(" ") + QString::fromStdString(asset_label); + str += QString(" ") + QString::fromStdString(gAssetsDir.GetIdentifier(asset)); } return str; } From 881862c9c3359f70cc2b13b985bba4bb27ad087b Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Tue, 9 Apr 2019 11:17:27 -0400 Subject: [PATCH 24/97] bugfix: issuance to self not a debit --- src/qt/transactionrecord.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 8d39b5dcc0..ecc0f852db 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -193,7 +193,7 @@ QList TransactionRecord::decomposeTransaction(const interface } // Short-circuit when it's an issuance to self - if (assets_issued_to_me_only.count(asset) == 0) { + if (assets_issued_to_me_only.count(asset) != 0) { continue; } From a1a8848555c73c8233fe6234e84c28c0f03df6d5 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 7 Jan 2019 12:12:27 +0000 Subject: [PATCH 25/97] GUI: GUIUtil::parseAssetAmount abstraction --- src/qt/guiutil.cpp | 9 +++++++++ src/qt/guiutil.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index c76d301615..f7cf72dcec 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -814,6 +814,15 @@ QString formatMultiAssetAmount(const CAmountMap& amountmap, const int bitcoin_un return ret.join(line_separator); } +bool parseAssetAmount(const CAsset& asset, const QString& text, const int bitcoin_unit, CAmount *val_out) +{ + if (asset == Params().GetConsensus().pegged_asset) { + return BitcoinUnits::parse(bitcoin_unit, text, val_out); + } + + return BitcoinUnits::parse(BitcoinUnits::BTC, text, val_out); +} + QString formatDurationStr(int secs) { QStringList strList; diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index 48ece311d7..c404b9bfbb 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -195,6 +195,9 @@ namespace GUIUtil /* Format one or more asset+amounts in a user-friendly style */ QString formatMultiAssetAmount(const CAmountMap&, int bitcoin_unit, BitcoinUnits::SeparatorStyle, QString line_separator); + /* Parse an amount of a given asset from text */ + bool parseAssetAmount(const CAsset&, const QString& text, int bitcoin_unit, CAmount *val_out); + /* Convert seconds into a QString with days, hours, mins, secs */ QString formatDurationStr(int secs); From 2c75c44417ec2dc4c18c968109b1971e9c23bef5 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 7 Jan 2019 12:12:49 +0000 Subject: [PATCH 26/97] GUI: BitcoinAmountField: Support for non-bitcoin assets --- src/qt/bitcoinamountfield.cpp | 157 ++++++++++++++++++++++++++++------ src/qt/bitcoinamountfield.h | 13 ++- 2 files changed, 142 insertions(+), 28 deletions(-) diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp index fb395eb763..36797eefd1 100644 --- a/src/qt/bitcoinamountfield.cpp +++ b/src/qt/bitcoinamountfield.cpp @@ -7,6 +7,10 @@ #include #include #include +#include "guiutil.h" + +#include "assetsdir.h" +#include "chainparams.h" #include #include @@ -14,6 +18,8 @@ #include #include +Q_DECLARE_METATYPE(CAsset) + /** QSpinBox that uses fixed-point numbers internally and uses our own * formatting/parsing functions. */ @@ -27,6 +33,8 @@ class AmountSpinBox: public QAbstractSpinBox currentUnit(BitcoinUnits::BTC), singleStep(0) { + current_asset = Params().GetConsensus().pegged_asset; + setAlignment(Qt::AlignRight); connect(lineEdit(), &QLineEdit::textEdited, this, &AmountSpinBox::valueChanged); @@ -48,42 +56,87 @@ class AmountSpinBox: public QAbstractSpinBox CAmount val = parse(input, &valid); if(valid) { - input = BitcoinUnits::format(currentUnit, val, false, BitcoinUnits::separatorAlways); + input = GUIUtil::formatAssetAmount(current_asset, val, currentUnit, BitcoinUnits::separatorAlways, false); lineEdit()->setText(input); } } - CAmount value(bool *valid_out=0) const + int currentPeggedUnit() const + { + assert(current_asset == Params().GetConsensus().pegged_asset); + return currentUnit; + } + + std::pair value(bool *valid_out=0) const { - return parse(text(), valid_out); + return std::make_pair(current_asset, parse(text(), valid_out)); } - void setValue(const CAmount& value) + void setValue(const CAsset& asset, CAmount value) { - lineEdit()->setText(BitcoinUnits::format(currentUnit, value, false, BitcoinUnits::separatorAlways)); + current_asset = asset; + lineEdit()->setText(GUIUtil::formatAssetAmount(asset, value, currentUnit, BitcoinUnits::separatorAlways, false)); Q_EMIT valueChanged(); } + inline void setValue(const std::pair& value) + { + setValue(value.first, value.second); + } + + void stepBy(int steps) { bool valid = false; - CAmount val = value(&valid); + auto val = value(&valid); CAmount currentSingleStep = singleStep; if (!currentSingleStep) { - currentSingleStep = 100000; // satoshis + if (current_asset == Params().GetConsensus().pegged_asset) { + currentSingleStep = 100000; // satoshis + } else { + currentSingleStep = 100000000; // a whole asset + } + } + val.second = val.second + steps * singleStep; + val.second = qMax(val.second, CAmount(0)); + if (val.first == Params().GetConsensus().pegged_asset) { + val.second = qMin(val.second, BitcoinUnits::maxMoney()); } - val = val + steps * singleStep; - val = qMin(qMax(val, CAmount(0)), BitcoinUnits::maxMoney()); setValue(val); } + void setDisplayUnit(const CAsset& asset) + { + if (asset == Params().GetConsensus().pegged_asset) { + setDisplayUnit(currentUnit); + return; + } + + // Only used for bitcoins -> other asset + // Leave the number alone, since the user probably intended it for this asset + + current_asset = asset; + Q_EMIT valueChanged(); + } + void setDisplayUnit(int unit) { bool valid = false; - CAmount val = value(&valid); + std::pair val = value(&valid); + const bool was_pegged = (val.first == Params().GetConsensus().pegged_asset); + current_asset = Params().GetConsensus().pegged_asset; currentUnit = unit; + if (!was_pegged) { + // Leave the text as-is, if it's valid + value(&valid); + if (valid) { + Q_EMIT valueChanged(); + } else { + clear(); + } + } else if(valid) setValue(val); else @@ -129,6 +182,7 @@ class AmountSpinBox: public QAbstractSpinBox } private: + CAsset current_asset; int currentUnit; CAmount singleStep; mutable QSize cachedMinimumSizeHint; @@ -141,11 +195,12 @@ class AmountSpinBox: public QAbstractSpinBox CAmount parse(const QString &text, bool *valid_out=0) const { CAmount val = 0; - bool valid = BitcoinUnits::parse(currentUnit, text, &val); + bool valid = GUIUtil::parseAssetAmount(current_asset, text, currentUnit, &val); if(valid) { - if(val < 0 || val > BitcoinUnits::maxMoney()) + if (val < 0 || (val > BitcoinUnits::maxMoney() && current_asset == Params().GetConsensus().pegged_asset)) { valid = false; + } } if(valid_out) *valid_out = valid; @@ -177,13 +232,15 @@ class AmountSpinBox: public QAbstractSpinBox StepEnabled rv = 0; bool valid = false; - CAmount val = value(&valid); + const std::pair val = value(&valid); if(valid) { - if(val > 0) + if (val.second > 0) { rv |= StepDownEnabled; - if(val < BitcoinUnits::maxMoney()) + } + if (val.second < BitcoinUnits::maxMoney() || val.first != Params().GetConsensus().pegged_asset) { rv |= StepUpEnabled; + } } return rv; } @@ -194,8 +251,9 @@ class AmountSpinBox: public QAbstractSpinBox #include -BitcoinAmountField::BitcoinAmountField(QWidget *parent) : +BitcoinAmountField::BitcoinAmountField(std::set allowed_assets, QWidget *parent) : QWidget(parent), + m_allowed_assets(allowed_assets), amount(0) { amount = new AmountSpinBox(this); @@ -205,8 +263,18 @@ BitcoinAmountField::BitcoinAmountField(QWidget *parent) : QHBoxLayout *layout = new QHBoxLayout(this); layout->addWidget(amount); - unit = new QValueComboBox(this); - unit->setModel(new BitcoinUnits(this)); + unit = new QComboBox(this); + m_allowed_assets = allowed_assets; + for (const auto& asset : allowed_assets) { + if (asset == Params().GetConsensus().pegged_asset) { + // Special handling + for (const auto& pegged_unit : BitcoinUnits::availableUnits()) { + unit->addItem(BitcoinUnits::shortName(pegged_unit), int(pegged_unit)); + } + continue; + } + unit->addItem(QString::fromStdString(gAssetsDir.GetIdentifier(asset)), QVariant::fromValue(asset)); + } layout->addWidget(unit); layout->addStretch(1); layout->setContentsMargins(0,0,0,0); @@ -224,6 +292,11 @@ BitcoinAmountField::BitcoinAmountField(QWidget *parent) : unitChanged(unit->currentIndex()); } +BitcoinAmountField::BitcoinAmountField(QWidget *parent) : + BitcoinAmountField(std::set({Params().GetConsensus().pegged_asset}), parent) +{ +} + void BitcoinAmountField::clear() { amount->clear(); @@ -239,7 +312,7 @@ void BitcoinAmountField::setEnabled(bool fEnabled) bool BitcoinAmountField::validate() { bool valid = false; - value(&valid); + fullValue(&valid); setValid(valid); return valid; } @@ -269,14 +342,28 @@ QWidget *BitcoinAmountField::setupTabChain(QWidget *prev) return unit; } -CAmount BitcoinAmountField::value(bool *valid_out) const +std::pair BitcoinAmountField::fullValue(bool *valid_out) const { return amount->value(valid_out); } +void BitcoinAmountField::setFullValue(const CAsset& asset, const CAmount& value) +{ + amount->setValue(asset, value); + setDisplayUnit(asset); +} + +CAmount BitcoinAmountField::value(bool *valid_out) const +{ + std::pair val = amount->value(valid_out); + assert(val.first == Params().GetConsensus().pegged_asset); + return val.second; +} + void BitcoinAmountField::setValue(const CAmount& value) { - amount->setValue(value); + amount->setValue(Params().GetConsensus().pegged_asset, value); + setDisplayUnit(amount->currentPeggedUnit()); } void BitcoinAmountField::setReadOnly(bool fReadOnly) @@ -287,17 +374,35 @@ void BitcoinAmountField::setReadOnly(bool fReadOnly) void BitcoinAmountField::unitChanged(int idx) { // Use description tooltip for current unit for the combobox - unit->setToolTip(unit->itemData(idx, Qt::ToolTipRole).toString()); + const QVariant& userdata = unit->itemData(idx, Qt::UserRole); + if (userdata.type() == QVariant::UserType) { + const CAsset asset = userdata.value(); + unit->setToolTip(tr("Custom asset (%1)").arg(QString::fromStdString(asset.GetHex()))); + + amount->setDisplayUnit(asset); + } else { + // Determine new unit ID + int newUnit = userdata.toInt(); - // Determine new unit ID - int newUnit = unit->itemData(idx, BitcoinUnits::UnitRole).toInt(); + unit->setToolTip(BitcoinUnits::description(newUnit)); - amount->setDisplayUnit(newUnit); + amount->setDisplayUnit(newUnit); + } +} + +void BitcoinAmountField::setDisplayUnit(const CAsset& asset) +{ + if (asset == Params().GetConsensus().pegged_asset) { + setDisplayUnit(amount->currentPeggedUnit()); + return; + } + // TODO: make sure it's an item + unit->setCurrentIndex(unit->findData(QVariant::fromValue(asset), Qt::UserRole)); } void BitcoinAmountField::setDisplayUnit(int newUnit) { - unit->setValue(newUnit); + unit->setCurrentIndex(unit->findData(newUnit, Qt::UserRole)); } void BitcoinAmountField::setSingleStep(const CAmount& step) diff --git a/src/qt/bitcoinamountfield.h b/src/qt/bitcoinamountfield.h index f93579c492..83ec6f3981 100644 --- a/src/qt/bitcoinamountfield.h +++ b/src/qt/bitcoinamountfield.h @@ -6,13 +6,15 @@ #define BITCOIN_QT_BITCOINAMOUNTFIELD_H #include +#include +#include #include class AmountSpinBox; QT_BEGIN_NAMESPACE -class QValueComboBox; +class QComboBox; QT_END_NAMESPACE /** Widget for entering bitcoin amounts. @@ -26,8 +28,12 @@ class BitcoinAmountField: public QWidget Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY valueChanged USER true) public: + explicit BitcoinAmountField(std::set allowed_assets, QWidget *parent = 0); explicit BitcoinAmountField(QWidget *parent = 0); + std::pair fullValue(bool *valid=0) const; + void setFullValue(const CAsset& asset, const CAmount& value); + CAmount value(bool *value=0) const; void setValue(const CAmount& value); @@ -43,6 +49,7 @@ class BitcoinAmountField: public QWidget bool validate(); /** Change unit used to display amount. */ + void setDisplayUnit(const CAsset&); void setDisplayUnit(int unit); /** Make field empty and ready for new input. */ @@ -64,8 +71,10 @@ class BitcoinAmountField: public QWidget bool eventFilter(QObject *object, QEvent *event); private: + std::set m_allowed_assets; + CAsset asset; AmountSpinBox *amount; - QValueComboBox *unit; + QComboBox *unit; private Q_SLOTS: void unitChanged(int idx); From 3e669cd31de2b47ade6a75c46cc58ccd7859ed2e Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 7 Jan 2019 12:25:39 +0000 Subject: [PATCH 27/97] GUI: BitcoinAmountField: Allow code to set assets not in allowed_assets --- src/qt/bitcoinamountfield.cpp | 54 +++++++++++++++++++++++++++++------ src/qt/bitcoinamountfield.h | 4 +++ 2 files changed, 49 insertions(+), 9 deletions(-) diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp index 36797eefd1..80d25d6b01 100644 --- a/src/qt/bitcoinamountfield.cpp +++ b/src/qt/bitcoinamountfield.cpp @@ -266,14 +266,7 @@ BitcoinAmountField::BitcoinAmountField(std::set allowed_assets, QWidget unit = new QComboBox(this); m_allowed_assets = allowed_assets; for (const auto& asset : allowed_assets) { - if (asset == Params().GetConsensus().pegged_asset) { - // Special handling - for (const auto& pegged_unit : BitcoinUnits::availableUnits()) { - unit->addItem(BitcoinUnits::shortName(pegged_unit), int(pegged_unit)); - } - continue; - } - unit->addItem(QString::fromStdString(gAssetsDir.GetIdentifier(asset)), QVariant::fromValue(asset)); + addAssetChoice(asset); } layout->addWidget(unit); layout->addStretch(1); @@ -371,8 +364,42 @@ void BitcoinAmountField::setReadOnly(bool fReadOnly) amount->setReadOnly(fReadOnly); } +bool BitcoinAmountField::hasAssetChoice(const CAsset& asset) const +{ + if (asset == Params().GetConsensus().pegged_asset) { + return -1 != unit->findData(0, Qt::UserRole); + } + return -1 != unit->findData(QVariant::fromValue(asset), Qt::UserRole); +} + +void BitcoinAmountField::addAssetChoice(const CAsset& asset) +{ + if (asset == Params().GetConsensus().pegged_asset) { + // Special handling + for (const auto& pegged_unit : BitcoinUnits::availableUnits()) { + unit->addItem(BitcoinUnits::shortName(pegged_unit), int(pegged_unit)); + } + return; + } + unit->addItem(QString::fromStdString(gAssetsDir.GetIdentifier(asset)), QVariant::fromValue(asset)); +} + +void BitcoinAmountField::removeAssetChoice(const CAsset& asset) +{ + if (asset == Params().GetConsensus().pegged_asset) { + // Special handling + for (const auto& pegged_unit : BitcoinUnits::availableUnits()) { + unit->removeItem(unit->findData(int(pegged_unit), Qt::UserRole)); + } + return; + } + unit->removeItem(unit->findData(QVariant::fromValue(asset), Qt::UserRole)); +} + void BitcoinAmountField::unitChanged(int idx) { + const CAsset previous_asset = amount->value().first; + // Use description tooltip for current unit for the combobox const QVariant& userdata = unit->itemData(idx, Qt::UserRole); if (userdata.type() == QVariant::UserType) { @@ -388,6 +415,10 @@ void BitcoinAmountField::unitChanged(int idx) amount->setDisplayUnit(newUnit); } + + if (!(m_allowed_assets.count(previous_asset) || amount->value().first == previous_asset)) { + removeAssetChoice(previous_asset); + } } void BitcoinAmountField::setDisplayUnit(const CAsset& asset) @@ -396,12 +427,17 @@ void BitcoinAmountField::setDisplayUnit(const CAsset& asset) setDisplayUnit(amount->currentPeggedUnit()); return; } - // TODO: make sure it's an item + if (!hasAssetChoice(asset)) { + addAssetChoice(asset); + } unit->setCurrentIndex(unit->findData(QVariant::fromValue(asset), Qt::UserRole)); } void BitcoinAmountField::setDisplayUnit(int newUnit) { + if (!hasAssetChoice(Params().GetConsensus().pegged_asset)) { + addAssetChoice(Params().GetConsensus().pegged_asset); + } unit->setCurrentIndex(unit->findData(newUnit, Qt::UserRole)); } diff --git a/src/qt/bitcoinamountfield.h b/src/qt/bitcoinamountfield.h index 83ec6f3981..b6a8b6c90e 100644 --- a/src/qt/bitcoinamountfield.h +++ b/src/qt/bitcoinamountfield.h @@ -76,6 +76,10 @@ class BitcoinAmountField: public QWidget AmountSpinBox *amount; QComboBox *unit; + bool hasAssetChoice(const CAsset&) const; + void addAssetChoice(const CAsset&); + void removeAssetChoice(const CAsset&); + private Q_SLOTS: void unitChanged(int idx); From 7f00087b532f218034fed886ddb52cf9955a4311 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 7 Jan 2019 12:40:20 +0000 Subject: [PATCH 28/97] GUI: BitcoinAmountField: Allow changing allowed assets after construction --- src/qt/bitcoinamountfield.cpp | 24 ++++++++++++++++++++++++ src/qt/bitcoinamountfield.h | 2 ++ 2 files changed, 26 insertions(+) diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp index 80d25d6b01..c389d0bd71 100644 --- a/src/qt/bitcoinamountfield.cpp +++ b/src/qt/bitcoinamountfield.cpp @@ -396,6 +396,30 @@ void BitcoinAmountField::removeAssetChoice(const CAsset& asset) unit->removeItem(unit->findData(QVariant::fromValue(asset), Qt::UserRole)); } +void BitcoinAmountField::setAllowedAssets(const std::set& allowed_assets) +{ + std::set assets_to_remove; + for (const auto& asset : m_allowed_assets) { + if (!allowed_assets.count(asset)) { + assets_to_remove.insert(asset); + } + } + m_allowed_assets = allowed_assets; + const QVariant& sel_userdata = unit->itemData(unit->currentIndex(), Qt::UserRole); + const CAsset sel_asset = (sel_userdata.type() == QVariant::UserType) ? sel_userdata.value() : Params().GetConsensus().pegged_asset; + for (const auto& asset : assets_to_remove) { + // Leave it in place for now if it's selected + if (sel_asset == asset) continue; + + removeAssetChoice(asset); + } + for (const auto& asset : allowed_assets) { + if (!hasAssetChoice(asset)) { + addAssetChoice(asset); + } + } +} + void BitcoinAmountField::unitChanged(int idx) { const CAsset previous_asset = amount->value().first; diff --git a/src/qt/bitcoinamountfield.h b/src/qt/bitcoinamountfield.h index b6a8b6c90e..cb3b3c98cf 100644 --- a/src/qt/bitcoinamountfield.h +++ b/src/qt/bitcoinamountfield.h @@ -48,6 +48,8 @@ class BitcoinAmountField: public QWidget /** Perform input validation, mark field as invalid if entered value is not valid. */ bool validate(); + void setAllowedAssets(const std::set& allowed_assets); + /** Change unit used to display amount. */ void setDisplayUnit(const CAsset&); void setDisplayUnit(int unit); From a163be0ae1d71b1fbac6b6ed55e97b9aa9b0e971 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 7 Jan 2019 12:53:12 +0000 Subject: [PATCH 29/97] GUI: WalletModel: Track asset type collection --- src/qt/walletmodel.cpp | 15 +++++++++++++++ src/qt/walletmodel.h | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 5a6e650aba..50015163a1 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -56,6 +56,11 @@ WalletModel::~WalletModel() unsubscribeFromCoreSignals(); } +std::set WalletModel::getAssetTypes() const +{ + return cached_asset_types; +} + void WalletModel::updateStatus() { EncryptionStatus newEncryptionStatus = getEncryptionStatus(); @@ -95,6 +100,16 @@ void WalletModel::checkBalanceChanged(const interfaces::WalletBalances& new_bala if(new_balances.balanceChanged(m_cached_balances)) { m_cached_balances = new_balances; Q_EMIT balanceChanged(new_balances); + + std::set new_asset_types; + for (const auto& assetamount : new_balances.balance + new_balances.unconfirmed_balance) { + if (!assetamount.second) continue; + new_asset_types.insert(assetamount.first); + } + if (new_asset_types != cached_asset_types) { + cached_asset_types = new_asset_types; + Q_EMIT assetTypesChanged(); + } } } diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index b22728c69b..815e6df3d1 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -140,6 +140,7 @@ class WalletModel : public QObject TransactionTableModel *getTransactionTableModel(); RecentRequestsTableModel *getRecentRequestsTableModel(); + std::set getAssetTypes() const; EncryptionStatus getEncryptionStatus() const; // Check address for validity @@ -230,6 +231,7 @@ class WalletModel : public QObject // Cache some values to be able to detect changes interfaces::WalletBalances m_cached_balances; + std::set cached_asset_types; EncryptionStatus cachedEncryptionStatus; int cachedNumBlocks; @@ -243,6 +245,9 @@ class WalletModel : public QObject // Signal that balance in wallet changed void balanceChanged(const interfaces::WalletBalances& balances); + // Signal that the set of possessed asset types changed + void assetTypesChanged(); + // Encryption status of wallet changed void encryptionStatusChanged(); From 2ebae1ab89e2fe11bdde17efa2ed78af31725f0e Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 7 Jan 2019 14:44:20 +0000 Subject: [PATCH 30/97] GUI: SendCoinsEntry: Propagate asset types available to amount field --- src/qt/sendcoinsentry.cpp | 12 +++++++++++- src/qt/sendcoinsentry.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index b394ff3150..4d0df9e1a2 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -81,8 +81,10 @@ void SendCoinsEntry::setModel(WalletModel *_model) { this->model = _model; - if (_model && _model->getOptionsModel()) + if (_model && _model->getOptionsModel()) { connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &SendCoinsEntry::updateDisplayUnit); + connect(_model, SIGNAL(assetTypesChanged()), this, SLOT(updateAssetTypes())); + } clear(); } @@ -107,6 +109,7 @@ void SendCoinsEntry::clear() ui->payAmount_s->clear(); // update the display unit, to not use the default ("BTC") + updateAssetTypes(); updateDisplayUnit(); } @@ -251,6 +254,13 @@ void SendCoinsEntry::setFocus() ui->payTo->setFocus(); } +void SendCoinsEntry::updateAssetTypes() +{ + if (model) { + ui->payAmount->setAllowedAssets(model->getAssetTypes()); + } +} + void SendCoinsEntry::updateDisplayUnit() { if(model && model->getOptionsModel()) diff --git a/src/qt/sendcoinsentry.h b/src/qt/sendcoinsentry.h index 48ecd598d6..935f1622b0 100644 --- a/src/qt/sendcoinsentry.h +++ b/src/qt/sendcoinsentry.h @@ -64,6 +64,7 @@ private Q_SLOTS: void on_addressBookButton_clicked(); void on_pasteButton_clicked(); void updateDisplayUnit(); + void updateAssetTypes(); private: SendCoinsRecipient recipient; From af726c7c36325ee469d388f9eb11a654bced4a59 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 7 Jan 2019 14:49:00 +0000 Subject: [PATCH 31/97] GUI: BitcoinAmountField: Limit issued assets to 21M MoneyRange at least seems to enforce 21M on assets, so do it here too --- src/qt/bitcoinamountfield.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp index c389d0bd71..83ecb44002 100644 --- a/src/qt/bitcoinamountfield.cpp +++ b/src/qt/bitcoinamountfield.cpp @@ -99,7 +99,9 @@ class AmountSpinBox: public QAbstractSpinBox } val.second = val.second + steps * singleStep; val.second = qMax(val.second, CAmount(0)); - if (val.first == Params().GetConsensus().pegged_asset) { + // FIXME: Add this back in when assets can have > MAX_MONEY + // if (val.first == Params().GetConsensus().pegged_asset) + { val.second = qMin(val.second, BitcoinUnits::maxMoney()); } setValue(val); @@ -198,7 +200,8 @@ class AmountSpinBox: public QAbstractSpinBox bool valid = GUIUtil::parseAssetAmount(current_asset, text, currentUnit, &val); if(valid) { - if (val < 0 || (val > BitcoinUnits::maxMoney() && current_asset == Params().GetConsensus().pegged_asset)) { + // FIXME: Add this back in when assets can have > MAX_MONEY + if (val < 0 || (val > BitcoinUnits::maxMoney() /*&& current_asset == Params().GetConsensus().pegged_asset*/)) { valid = false; } } From 466b3d03f5a2359a63a7faa4eb110a0f1fbeafcd Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 7 Jan 2019 16:00:34 +0000 Subject: [PATCH 32/97] CAmountMap::operator! to check if empty --- src/asset.cpp | 8 ++++++++ src/asset.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/asset.cpp b/src/asset.cpp index 9831c7ea5c..70c5a91154 100644 --- a/src/asset.cpp +++ b/src/asset.cpp @@ -121,6 +121,14 @@ bool operator!=(const CAmountMap& a, const CAmountMap& b) return !(a == b); } +bool operator!(const CAmountMap& a) +{ + for (const auto& it : a) { + if (it.second) return false; + } + return true; +} + bool hasNegativeValue(const CAmountMap& amount) { for(std::map::const_iterator it = amount.begin(); it != amount.end(); ++it) { diff --git a/src/asset.h b/src/asset.h index 381df84c4f..483170df32 100644 --- a/src/asset.h +++ b/src/asset.h @@ -93,6 +93,7 @@ bool operator>(const CAmountMap& a, const CAmountMap& b); bool operator>=(const CAmountMap& a, const CAmountMap& b); bool operator==(const CAmountMap& a, const CAmountMap& b); bool operator!=(const CAmountMap& a, const CAmountMap& b); +bool operator!(const CAmountMap& a); // Check if all values are 0 inline bool MoneyRange(const CAmountMap& mapValue) { for(CAmountMap::const_iterator it = mapValue.begin(); it != mapValue.end(); it++) { From 70458f6f9d8999317e3cffab4ef6df6abbbded71 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Tue, 9 Apr 2019 12:12:13 -0400 Subject: [PATCH 33/97] Pad change keys for wallet interface pending txs --- src/interfaces/wallet.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index 33185c297d..312ca27803 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -235,6 +235,11 @@ class WalletImpl : public Wallet { LOCK2(cs_main, m_wallet.cs_wallet); auto pending = MakeUnique(m_wallet); + // Pad change keys to cover total possible number of assets + // One already exists(for policyAsset), so one for each destination + for (size_t i = 0; i < recipients.size(); ++i) { + pending->m_keys.emplace_back(new CReserveKey(&m_wallet)); + } if (!m_wallet.CreateTransaction(recipients, pending->m_tx, pending->m_keys, fee, change_pos, fail_reason, coin_control, sign)) { return {}; From f4d5552f6c4cc284fc85037648daad5475ad7d6b Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 8 Jan 2019 13:59:53 +0000 Subject: [PATCH 34/97] GUI: Clone SendCoinsRecipient to SendAssetsRecipient --- src/qt/paymentserver.cpp | 2 +- src/qt/paymentserver.h | 2 +- src/qt/sendcoinsdialog.cpp | 8 ++++---- src/qt/sendcoinsentry.cpp | 4 ++-- src/qt/sendcoinsentry.h | 6 +++--- src/qt/walletmodel.cpp | 18 ++++++++++++++---- src/qt/walletmodel.h | 19 ++++++++++++++++++- src/qt/walletmodeltransaction.cpp | 10 +++++----- src/qt/walletmodeltransaction.h | 8 ++++---- 9 files changed, 52 insertions(+), 25 deletions(-) diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index 43fc614871..87f0fa527b 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -605,7 +605,7 @@ void PaymentServer::fetchRequest(const QUrl& url) netManager->get(netRequest); } -void PaymentServer::fetchPaymentACK(WalletModel* walletModel, const SendCoinsRecipient& recipient, QByteArray transaction) +void PaymentServer::fetchPaymentACK(WalletModel* walletModel, const SendAssetsRecipient& recipient, QByteArray transaction) { const payments::PaymentDetails& details = recipient.paymentRequest.getDetails(); if (!details.has_payment_url()) diff --git a/src/qt/paymentserver.h b/src/qt/paymentserver.h index d335db9c85..464f02364f 100644 --- a/src/qt/paymentserver.h +++ b/src/qt/paymentserver.h @@ -111,7 +111,7 @@ public Q_SLOTS: void uiReady(); // Submit Payment message to a merchant, get back PaymentACK: - void fetchPaymentACK(WalletModel* walletModel, const SendCoinsRecipient& recipient, QByteArray transaction); + void fetchPaymentACK(WalletModel* walletModel, const SendAssetsRecipient& recipient, QByteArray transaction); // Handle an incoming URI, URI with local file scheme or file void handleURIOrFile(const QString& s); diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index 0a268f7898..cbecd4cbfb 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -217,7 +217,7 @@ void SendCoinsDialog::on_sendButton_clicked() if(!model || !model->getOptionsModel()) return; - QList recipients; + QList recipients; bool valid = true; for(int i = 0; i < ui->entries->count(); ++i) @@ -276,7 +276,7 @@ void SendCoinsDialog::on_sendButton_clicked() // Format confirmation message QStringList formatted; - for (const SendCoinsRecipient &rcp : currentTransaction.getRecipients()) + for (const SendAssetsRecipient &rcp : currentTransaction.getRecipients()) { // generate bold amount string with wallet name in case of multiwallet QString amount = "" + BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), rcp.amount); @@ -511,7 +511,7 @@ void SendCoinsDialog::pasteEntry(const SendCoinsRecipient &rv) entry = addEntry(); } - entry->setValue(rv); + entry->setValue(SendAssetsRecipient(rv)); updateTabsAndLabels(); } @@ -871,7 +871,7 @@ void SendCoinsDialog::coinControlUpdateLabels() SendCoinsEntry *entry = qobject_cast(ui->entries->itemAt(i)->widget()); if(entry && !entry->isHidden()) { - SendCoinsRecipient rcp = entry->getValue(); + auto rcp = entry->getValue(); CoinControlDialog::payAmounts.append(rcp.amount); if (rcp.fSubtractFeeFromAmount) CoinControlDialog::fSubtractFeeFromAmount = true; diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index 4d0df9e1a2..ed3436b68e 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -167,7 +167,7 @@ bool SendCoinsEntry::validate(interfaces::Node& node) return retval; } -SendCoinsRecipient SendCoinsEntry::getValue() +SendAssetsRecipient SendCoinsEntry::getValue() { // Payment request if (recipient.paymentRequest.IsInitialized()) @@ -195,7 +195,7 @@ QWidget *SendCoinsEntry::setupTabChain(QWidget *prev) return ui->deleteButton; } -void SendCoinsEntry::setValue(const SendCoinsRecipient &value) +void SendCoinsEntry::setValue(const SendAssetsRecipient &value) { recipient = value; diff --git a/src/qt/sendcoinsentry.h b/src/qt/sendcoinsentry.h index 935f1622b0..2588685bd8 100644 --- a/src/qt/sendcoinsentry.h +++ b/src/qt/sendcoinsentry.h @@ -31,12 +31,12 @@ class SendCoinsEntry : public QStackedWidget void setModel(WalletModel *model); bool validate(interfaces::Node& node); - SendCoinsRecipient getValue(); + SendAssetsRecipient getValue(); /** Return whether the entry is still empty and unedited */ bool isClear(); - void setValue(const SendCoinsRecipient &value); + void setValue(const SendAssetsRecipient &value); void setAddress(const QString &address); void setAmount(const CAmount &amount); @@ -67,7 +67,7 @@ private Q_SLOTS: void updateAssetTypes(); private: - SendCoinsRecipient recipient; + SendAssetsRecipient recipient; Ui::SendCoinsEntry *ui; WalletModel *model; const PlatformStyle *platformStyle; diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 50015163a1..98a7555c97 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -28,6 +28,16 @@ #include #include +SendAssetsRecipient::SendAssetsRecipient(SendCoinsRecipient r) : + address(r.address), + label(r.label), + amount(r.amount), + message(r.message), + paymentRequest(r.paymentRequest), + authenticatedMerchant(r.authenticatedMerchant), + fSubtractFeeFromAmount(r.fSubtractFeeFromAmount) +{ +} WalletModel::WalletModel(std::unique_ptr wallet, interfaces::Node& node, const PlatformStyle *platformStyle, OptionsModel *_optionsModel, QObject *parent) : QObject(parent), m_wallet(std::move(wallet)), m_node(node), optionsModel(_optionsModel), addressTableModel(0), @@ -141,7 +151,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact { CAmount total = 0; bool fSubtractFeeFromAmount = false; - QList recipients = transaction.getRecipients(); + auto recipients = transaction.getRecipients(); std::vector vecSend; if(recipients.empty()) @@ -153,7 +163,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact int nAddresses = 0; // Pre-check input data for validity - for (const SendCoinsRecipient &rcp : recipients) + for (const SendAssetsRecipient &rcp : recipients) { if (rcp.fSubtractFeeFromAmount) fSubtractFeeFromAmount = true; @@ -249,7 +259,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran { std::vector> vOrderForm; - for (const SendCoinsRecipient &rcp : transaction.getRecipients()) + for (const SendAssetsRecipient &rcp : transaction.getRecipients()) { if (rcp.paymentRequest.IsInitialized()) { @@ -279,7 +289,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran // Add addresses / update labels that we've sent to the address book, // and emit coinsSent signal for each recipient - for (const SendCoinsRecipient &rcp : transaction.getRecipients()) + for (const SendAssetsRecipient &rcp : transaction.getRecipients()) { // Don't touch the address book when we have a payment request if (!rcp.paymentRequest.IsInitialized()) diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index 815e6df3d1..fdc2d04ea2 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -105,6 +105,23 @@ class SendCoinsRecipient } }; +class SendAssetsRecipient +{ +public: + explicit SendAssetsRecipient() : fSubtractFeeFromAmount(false) { } + explicit SendAssetsRecipient(SendCoinsRecipient r); +public: + QString address; + QString label; + CAmount amount; + QString message; + + PaymentRequestPlus paymentRequest; + QString authenticatedMerchant; + + bool fSubtractFeeFromAmount; // memory only +}; + /** Interface to Bitcoin wallet from Qt view code. */ class WalletModel : public QObject { @@ -260,7 +277,7 @@ class WalletModel : public QObject void message(const QString &title, const QString &message, unsigned int style); // Coins sent: from wallet, to recipient, in (serialized) transaction: - void coinsSent(WalletModel* wallet, SendCoinsRecipient recipient, QByteArray transaction); + void coinsSent(WalletModel* wallet, SendAssetsRecipient recipient, QByteArray transaction); // Show progress dialog e.g. for rescan void showProgress(const QString &title, int nProgress); diff --git a/src/qt/walletmodeltransaction.cpp b/src/qt/walletmodeltransaction.cpp index 821b158a4f..50b9980af4 100644 --- a/src/qt/walletmodeltransaction.cpp +++ b/src/qt/walletmodeltransaction.cpp @@ -7,13 +7,13 @@ #include #include -WalletModelTransaction::WalletModelTransaction(const QList &_recipients) : +WalletModelTransaction::WalletModelTransaction(const QList &_recipients) : recipients(_recipients), fee(0) { } -QList WalletModelTransaction::getRecipients() const +QList WalletModelTransaction::getRecipients() const { return recipients; } @@ -42,9 +42,9 @@ void WalletModelTransaction::reassignAmounts(int nChangePosRet) { const CTransaction* walletTransaction = &wtx->get(); int i = 0; - for (QList::iterator it = recipients.begin(); it != recipients.end(); ++it) + for (auto it = recipients.begin(); it != recipients.end(); ++it) { - SendCoinsRecipient& rcp = (*it); + auto& rcp = (*it); if (rcp.paymentRequest.IsInitialized()) { @@ -74,7 +74,7 @@ void WalletModelTransaction::reassignAmounts(int nChangePosRet) CAmount WalletModelTransaction::getTotalTransactionAmount() const { CAmount totalTransactionAmount = 0; - for (const SendCoinsRecipient &rcp : recipients) + for (const SendAssetsRecipient &rcp : recipients) { totalTransactionAmount += rcp.amount; } diff --git a/src/qt/walletmodeltransaction.h b/src/qt/walletmodeltransaction.h index 75ede2e2a1..87d1915ab8 100644 --- a/src/qt/walletmodeltransaction.h +++ b/src/qt/walletmodeltransaction.h @@ -11,7 +11,7 @@ #include -class SendCoinsRecipient; +class SendAssetsRecipient; namespace interfaces { class Node; @@ -22,9 +22,9 @@ class PendingWalletTx; class WalletModelTransaction { public: - explicit WalletModelTransaction(const QList &recipients); + explicit WalletModelTransaction(const QList &recipients); - QList getRecipients() const; + QList getRecipients() const; std::unique_ptr& getWtx(); unsigned int getTransactionSize(); @@ -37,7 +37,7 @@ class WalletModelTransaction void reassignAmounts(int nChangePosRet); // needed for the subtract-fee-from-amount feature private: - QList recipients; + QList recipients; std::unique_ptr wtx; CAmount fee; }; From 79e0cb74ff1c59df1a44fe1a5848db389a621e7e Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 8 Jan 2019 14:18:10 +0000 Subject: [PATCH 35/97] GUI: Support for sending assets --- src/qt/guiutil.cpp | 4 +++- src/qt/sendcoinsdialog.cpp | 22 +++++++++++++------ src/qt/sendcoinsentry.cpp | 15 +++++++------ src/qt/walletmodel.cpp | 36 +++++++++++++++++++------------ src/qt/walletmodel.h | 3 ++- src/qt/walletmodeltransaction.cpp | 23 ++++++++++---------- src/qt/walletmodeltransaction.h | 4 ++-- 7 files changed, 65 insertions(+), 42 deletions(-) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index f7cf72dcec..74522ea695 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -799,7 +799,9 @@ QString formatAssetAmount(const CAsset& asset, const CAmount& amount, const int QString formatMultiAssetAmount(const CAmountMap& amountmap, const int bitcoin_unit, BitcoinUnits::SeparatorStyle separators, QString line_separator) { QStringList ret; - ret << formatAssetAmount(Params().GetConsensus().pegged_asset, amountmap.count(Params().GetConsensus().pegged_asset) ? amountmap.at(Params().GetConsensus().pegged_asset) : 0, bitcoin_unit, separators); + if (bitcoin_unit >= 0) { + ret << formatAssetAmount(Params().GetConsensus().pegged_asset, amountmap.count(Params().GetConsensus().pegged_asset) ? amountmap.at(Params().GetConsensus().pegged_asset) : 0, bitcoin_unit, separators); + } for (const auto& assetamount : amountmap) { if (assetamount.first == Params().GetConsensus().pegged_asset) { // Already handled first diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index cbecd4cbfb..a57d732184 100644 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -275,11 +275,12 @@ void SendCoinsDialog::on_sendButton_clicked() CAmount txFee = currentTransaction.getTransactionFee(); // Format confirmation message + int bitcoin_unit = model->getOptionsModel()->getDisplayUnit(); QStringList formatted; for (const SendAssetsRecipient &rcp : currentTransaction.getRecipients()) { // generate bold amount string with wallet name in case of multiwallet - QString amount = "" + BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), rcp.amount); + QString amount = "" + GUIUtil::formatAssetAmount(rcp.asset, rcp.asset_amount, bitcoin_unit, BitcoinUnits::separatorStandard, true); if (model->isMultiwallet()) { amount.append(" "+tr("from wallet %1").arg(GUIUtil::HtmlEscape(model->getWalletName()))+" "); } @@ -347,17 +348,22 @@ void SendCoinsDialog::on_sendButton_clicked() // add total amount in all subdivision units questionString.append("
"); - CAmount totalAmount = currentTransaction.getTotalTransactionAmount() + txFee; + CAmountMap totalAmount = currentTransaction.getTotalTransactionAmount(); + totalAmount[Params().GetConsensus().pegged_asset] += txFee; QStringList alternativeUnits; for (const BitcoinUnits::Unit u : BitcoinUnits::availableUnits()) { if(u != model->getOptionsModel()->getDisplayUnit()) - alternativeUnits.append(BitcoinUnits::formatHtmlWithUnit(u, totalAmount)); + alternativeUnits.append(BitcoinUnits::formatHtmlWithUnit(u, totalAmount[Params().GetConsensus().pegged_asset])); } questionString.append(QString("%1: %2").arg(tr("Total Amount")) - .arg(BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), totalAmount))); + .arg(BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), totalAmount[Params().GetConsensus().pegged_asset]))); questionString.append(QString("
(=%1)") .arg(alternativeUnits.join(" " + tr("or") + " "))); + totalAmount.erase(Params().GetConsensus().pegged_asset); + if (!!totalAmount) { + questionString.append(" " + tr("and") + "
" + GUIUtil::formatMultiAssetAmount(totalAmount, -1 /*bitcoin unit, hide*/, BitcoinUnits::separatorStandard, ";
")); + } SendConfirmationDialog confirmationDialog(tr("Confirm send coins"), questionString.arg(formatted.join("
")), SEND_CONFIRM_DELAY, this); @@ -623,7 +629,7 @@ void SendCoinsDialog::useAvailableBalance(SendCoinsEntry* entry) for (int i = 0; i < ui->entries->count(); ++i) { SendCoinsEntry* e = qobject_cast(ui->entries->itemAt(i)->widget()); if (e && !e->isHidden() && e != entry) { - amount -= e->getValue().amount; + amount -= e->getValue().asset_amount; } } @@ -871,8 +877,10 @@ void SendCoinsDialog::coinControlUpdateLabels() SendCoinsEntry *entry = qobject_cast(ui->entries->itemAt(i)->widget()); if(entry && !entry->isHidden()) { - auto rcp = entry->getValue(); - CoinControlDialog::payAmounts.append(rcp.amount); + SendAssetsRecipient rcp = entry->getValue(); + if (rcp.asset == Params().GetConsensus().pegged_asset) { + CoinControlDialog::payAmounts.append(rcp.asset_amount); + } if (rcp.fSubtractFeeFromAmount) CoinControlDialog::fSubtractFeeFromAmount = true; } diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index ed3436b68e..d3ee221107 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -14,6 +14,8 @@ #include #include +#include + SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *parent) : QStackedWidget(parent), ui(new Ui::SendCoinsEntry), @@ -152,14 +154,15 @@ bool SendCoinsEntry::validate(interfaces::Node& node) } // Sending a zero amount is invalid - if (ui->payAmount->value(0) <= 0) + const auto send_assets = ui->payAmount->fullValue(); + if (send_assets.second <= 0) { ui->payAmount->setValid(false); retval = false; } // Reject dust outputs: - if (retval && GUIUtil::isDust(node, ui->payTo->text(), ui->payAmount->value())) { + if (retval && send_assets.first == ::policyAsset && GUIUtil::isDust(node, ui->payTo->text(), ui->payAmount->value())) { ui->payAmount->setValid(false); retval = false; } @@ -176,7 +179,7 @@ SendAssetsRecipient SendCoinsEntry::getValue() // Normal payment recipient.address = ui->payTo->text(); recipient.label = ui->addAsLabel->text(); - recipient.amount = ui->payAmount->value(); + std::tie(recipient.asset, recipient.asset_amount) = ui->payAmount->fullValue(); recipient.message = ui->messageTextLabel->text(); recipient.fSubtractFeeFromAmount = (ui->checkboxSubtractFeeFromAmount->checkState() == Qt::Checked); @@ -205,7 +208,7 @@ void SendCoinsEntry::setValue(const SendAssetsRecipient &value) { ui->payTo_is->setText(recipient.address); ui->memoTextLabel_is->setText(recipient.message); - ui->payAmount_is->setValue(recipient.amount); + ui->payAmount_is->setFullValue(recipient.asset, recipient.asset_amount); ui->payAmount_is->setReadOnly(true); setCurrentWidget(ui->SendCoins_UnauthenticatedPaymentRequest); } @@ -213,7 +216,7 @@ void SendCoinsEntry::setValue(const SendAssetsRecipient &value) { ui->payTo_s->setText(recipient.authenticatedMerchant); ui->memoTextLabel_s->setText(recipient.message); - ui->payAmount_s->setValue(recipient.amount); + ui->payAmount_s->setFullValue(recipient.asset, recipient.asset_amount); ui->payAmount_s->setReadOnly(true); setCurrentWidget(ui->SendCoins_AuthenticatedPaymentRequest); } @@ -229,7 +232,7 @@ void SendCoinsEntry::setValue(const SendAssetsRecipient &value) ui->payTo->setText(recipient.address); // this may set a label from addressbook if (!recipient.label.isEmpty()) // if a label had been set from the addressbook, don't overwrite with an empty label ui->addAsLabel->setText(recipient.label); - ui->payAmount->setValue(recipient.amount); + ui->payAmount->setFullValue(recipient.asset, recipient.asset_amount); } } diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 98a7555c97..7131cd7ef0 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -20,6 +20,7 @@ #include // for GetBoolArg #include #include +#include #include @@ -31,7 +32,8 @@ SendAssetsRecipient::SendAssetsRecipient(SendCoinsRecipient r) : address(r.address), label(r.label), - amount(r.amount), + asset(Params().GetConsensus().pegged_asset), + asset_amount(r.amount), message(r.message), paymentRequest(r.paymentRequest), authenticatedMerchant(r.authenticatedMerchant), @@ -39,6 +41,8 @@ SendAssetsRecipient::SendAssetsRecipient(SendCoinsRecipient r) : { } +#define SendCoinsRecipient SendAssetsRecipient + WalletModel::WalletModel(std::unique_ptr wallet, interfaces::Node& node, const PlatformStyle *platformStyle, OptionsModel *_optionsModel, QObject *parent) : QObject(parent), m_wallet(std::move(wallet)), m_node(node), optionsModel(_optionsModel), addressTableModel(0), transactionTableModel(0), @@ -149,9 +153,9 @@ bool WalletModel::validateAddress(const QString &address) WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransaction &transaction, const CCoinControl& coinControl) { - CAmount total = 0; + CAmountMap total; bool fSubtractFeeFromAmount = false; - auto recipients = transaction.getRecipients(); + QList recipients = transaction.getRecipients(); std::vector vecSend; if(recipients.empty()) @@ -163,7 +167,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact int nAddresses = 0; // Pre-check input data for validity - for (const SendAssetsRecipient &rcp : recipients) + for (const SendCoinsRecipient &rcp : recipients) { if (rcp.fSubtractFeeFromAmount) fSubtractFeeFromAmount = true; @@ -187,7 +191,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact { return InvalidAmount; } - total += subtotal; + total[Params().GetConsensus().pegged_asset] += subtotal; } else { // User-entered bitcoin address / amount: @@ -195,18 +199,20 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact { return InvalidAddress; } - if(rcp.amount <= 0) + if(rcp.asset_amount <= 0) { return InvalidAmount; } setAddress.insert(rcp.address); ++nAddresses; - CScript scriptPubKey = GetScriptForDestination(DecodeDestination(rcp.address.toStdString())); - CRecipient recipient = {scriptPubKey, rcp.amount, ::policyAsset, CPubKey(), rcp.fSubtractFeeFromAmount}; + CTxDestination dest = DecodeDestination(rcp.address.toStdString()); + CScript scriptPubKey = GetScriptForDestination(dest); + CPubKey confidentiality_pubkey = GetDestinationBlindingKey(dest); + CRecipient recipient = {scriptPubKey, rcp.asset_amount, rcp.asset, confidentiality_pubkey, rcp.fSubtractFeeFromAmount}; vecSend.push_back(recipient); - total += rcp.amount; + total[rcp.asset] += rcp.asset_amount; } } if(setAddress.size() != nAddresses) @@ -214,7 +220,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact return DuplicateAddress; } - CAmount nBalance = m_wallet->getAvailableBalance(coinControl)[::policyAsset]; + CAmountMap nBalance = m_wallet->getAvailableBalance(coinControl); if(total > nBalance) { @@ -227,14 +233,16 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact std::string strFailReason; auto& newTx = transaction.getWtx(); + std::vector out_amounts; newTx = m_wallet->createTransaction(vecSend, coinControl, true /* sign */, nChangePosRet, nFeeRequired, strFailReason); transaction.setTransactionFee(nFeeRequired); if (fSubtractFeeFromAmount && newTx) - transaction.reassignAmounts(nChangePosRet); + transaction.reassignAmounts(out_amounts, nChangePosRet); if(!newTx) { - if(!fSubtractFeeFromAmount && (total + nFeeRequired) > nBalance) + total[Params().GetConsensus().pegged_asset] += nFeeRequired; + if(!fSubtractFeeFromAmount && total > nBalance) { return SendCoinsReturn(AmountWithFeeExceedsBalance); } @@ -259,7 +267,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran { std::vector> vOrderForm; - for (const SendAssetsRecipient &rcp : transaction.getRecipients()) + for (const SendCoinsRecipient &rcp : transaction.getRecipients()) { if (rcp.paymentRequest.IsInitialized()) { @@ -289,7 +297,7 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran // Add addresses / update labels that we've sent to the address book, // and emit coinsSent signal for each recipient - for (const SendAssetsRecipient &rcp : transaction.getRecipients()) + for (const SendCoinsRecipient &rcp : transaction.getRecipients()) { // Don't touch the address book when we have a payment request if (!rcp.paymentRequest.IsInitialized()) diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h index fdc2d04ea2..a16b374b3e 100644 --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -113,7 +113,8 @@ class SendAssetsRecipient public: QString address; QString label; - CAmount amount; + CAsset asset; + CAmount asset_amount; QString message; PaymentRequestPlus paymentRequest; diff --git a/src/qt/walletmodeltransaction.cpp b/src/qt/walletmodeltransaction.cpp index 50b9980af4..ab473a3fc3 100644 --- a/src/qt/walletmodeltransaction.cpp +++ b/src/qt/walletmodeltransaction.cpp @@ -7,13 +7,15 @@ #include #include -WalletModelTransaction::WalletModelTransaction(const QList &_recipients) : +#define SendCoinsRecipient SendAssetsRecipient + +WalletModelTransaction::WalletModelTransaction(const QList &_recipients) : recipients(_recipients), fee(0) { } -QList WalletModelTransaction::getRecipients() const +QList WalletModelTransaction::getRecipients() const { return recipients; } @@ -38,9 +40,8 @@ void WalletModelTransaction::setTransactionFee(const CAmount& newFee) fee = newFee; } -void WalletModelTransaction::reassignAmounts(int nChangePosRet) +void WalletModelTransaction::reassignAmounts(const std::vector& outAmounts, int nChangePosRet) { - const CTransaction* walletTransaction = &wtx->get(); int i = 0; for (auto it = recipients.begin(); it != recipients.end(); ++it) { @@ -56,27 +57,27 @@ void WalletModelTransaction::reassignAmounts(int nChangePosRet) if (out.amount() <= 0) continue; if (i == nChangePosRet) i++; - subtotal += walletTransaction->vout[i].nValue.GetAmount(); + subtotal += outAmounts[i]; i++; } - rcp.amount = subtotal; + rcp.asset_amount = subtotal; } else // normal recipient (no payment request) { if (i == nChangePosRet) i++; - rcp.amount = walletTransaction->vout[i].nValue.GetAmount(); + rcp.asset_amount = outAmounts[i]; i++; } } } -CAmount WalletModelTransaction::getTotalTransactionAmount() const +CAmountMap WalletModelTransaction::getTotalTransactionAmount() const { - CAmount totalTransactionAmount = 0; - for (const SendAssetsRecipient &rcp : recipients) + CAmountMap totalTransactionAmount; + for (const auto &rcp : recipients) { - totalTransactionAmount += rcp.amount; + totalTransactionAmount[rcp.asset] += rcp.asset_amount; } return totalTransactionAmount; } diff --git a/src/qt/walletmodeltransaction.h b/src/qt/walletmodeltransaction.h index 87d1915ab8..0a83f70c4b 100644 --- a/src/qt/walletmodeltransaction.h +++ b/src/qt/walletmodeltransaction.h @@ -32,9 +32,9 @@ class WalletModelTransaction void setTransactionFee(const CAmount& newFee); CAmount getTransactionFee() const; - CAmount getTotalTransactionAmount() const; + CAmountMap getTotalTransactionAmount() const; - void reassignAmounts(int nChangePosRet); // needed for the subtract-fee-from-amount feature + void reassignAmounts(const std::vector& out_amounts, int nChangePosRet); // needed for the subtract-fee-from-amount feature private: QList recipients; From 2a334b73ecadf5353127ea699b17f82705b9d589 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Tue, 9 Apr 2019 13:06:09 -0400 Subject: [PATCH 36/97] Slightly smarter change key vector padding --- src/interfaces/wallet.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index 312ca27803..9766fc5f9e 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -237,8 +237,11 @@ class WalletImpl : public Wallet auto pending = MakeUnique(m_wallet); // Pad change keys to cover total possible number of assets // One already exists(for policyAsset), so one for each destination - for (size_t i = 0; i < recipients.size(); ++i) { - pending->m_keys.emplace_back(new CReserveKey(&m_wallet)); + std::set assets_seen; + for (const auto& rec : recipients) { + if (assets_seen.insert(rec.asset).second) { + pending->m_keys.emplace_back(new CReserveKey(&m_wallet)); + } } if (!m_wallet.CreateTransaction(recipients, pending->m_tx, pending->m_keys, fee, change_pos, fail_reason, coin_control, sign)) { From 8048a6d8bfab74292e7b150c22f769eddfd2d403 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Tue, 9 Apr 2019 13:29:31 -0400 Subject: [PATCH 37/97] QT: have output amounts propagated for subtractfeefromoutput logic --- src/interfaces/wallet.cpp | 5 ++++- src/interfaces/wallet.h | 1 + src/qt/walletmodel.cpp | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index 9766fc5f9e..53e142c892 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -231,6 +231,7 @@ class WalletImpl : public Wallet bool sign, int& change_pos, CAmount& fee, + std::vector& out_amounts, std::string& fail_reason) override { LOCK2(cs_main, m_wallet.cs_wallet); @@ -243,10 +244,12 @@ class WalletImpl : public Wallet pending->m_keys.emplace_back(new CReserveKey(&m_wallet)); } } + BlindDetails blind_details; if (!m_wallet.CreateTransaction(recipients, pending->m_tx, pending->m_keys, fee, change_pos, - fail_reason, coin_control, sign)) { + fail_reason, coin_control, sign, &blind_details)) { return {}; } + out_amounts = blind_details.o_amounts; return std::move(pending); } bool transactionCanBeAbandoned(const uint256& txid) override { return m_wallet.TransactionCanBeAbandoned(txid); } diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index 87d1891863..d608aab0ad 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -138,6 +138,7 @@ class Wallet bool sign, int& change_pos, CAmount& fee, + std::vector& out_amounts, std::string& fail_reason) = 0; //! Return whether transaction can be abandoned. diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index 7131cd7ef0..6123cf7941 100644 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -234,9 +234,10 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact auto& newTx = transaction.getWtx(); std::vector out_amounts; - newTx = m_wallet->createTransaction(vecSend, coinControl, true /* sign */, nChangePosRet, nFeeRequired, strFailReason); + newTx = m_wallet->createTransaction(vecSend, coinControl, true /* sign */, nChangePosRet, nFeeRequired, out_amounts, strFailReason); transaction.setTransactionFee(nFeeRequired); if (fSubtractFeeFromAmount && newTx) + assert(out_amounts.size() == newTx->get().vout.size()); transaction.reassignAmounts(out_amounts, nChangePosRet); if(!newTx) From 6ab7bcc4eb89e03faaab1ad46bfe4540f1b1960b Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Tue, 9 Apr 2019 13:30:37 -0400 Subject: [PATCH 38/97] Bugfix: GUI: Overview: Fix hiding of immature when balances are zero --- src/qt/overviewpage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 2f3f3e5ec6..04235cdc35 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -170,8 +170,8 @@ void OverviewPage::setBalance(const interfaces::WalletBalances& balances) // 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.empty(); - bool showWatchOnlyImmature = !balances.immature_watch_only_balance.empty(); + bool showImmature = !!balances.immature_balance; + bool showWatchOnlyImmature = !!balances.immature_watch_only_balance; // for symmetry reasons also show immature label when the watch-only one is shown ui->labelImmature->setVisible(showImmature || showWatchOnlyImmature); From 66ac3e62e28de202b18d8b602c96c6e304ca9a8f Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 8 Jan 2019 14:50:14 +0000 Subject: [PATCH 39/97] GUI: Move the "Recent Transactions" view below "Balances" --- src/qt/overviewpage.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 04235cdc35..1983c7ae18 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -119,6 +119,11 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent) m_balances.balance[::policyAsset] = -1; + // Move the "Recent Transactions" view below "Balances" + ui->verticalLayout_3->removeWidget(ui->frame_2); + ui->verticalLayout_2->addWidget(ui->frame_2); + ui->horizontalLayout->removeItem(ui->verticalLayout_3); + // use a SingleColorIcon for the "out of sync warning" icon QIcon icon = platformStyle->SingleColorIcon(":/icons/warning"); icon.addPixmap(icon.pixmap(QSize(64,64), QIcon::Normal), QIcon::Disabled); // also set the disabled icon because we are using a disabled QPushButton to work around missing HiDPI support of QLabel (https://bugreports.qt.io/browse/QTBUG-42503) From 0d11cd0de9c87a9cc7e73f7d58a3ac46c53fced9 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sun, 6 Jan 2019 12:45:52 +0000 Subject: [PATCH 40/97] GUI: Transactions: Remove "to yourself" filter, no longer applicable --- src/qt/transactionview.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index b67cfe7f73..4d0a0dc8a4 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -122,7 +122,6 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa TransactionFilterProxy::TYPE(TransactionRecord::RecvFromOther)); typeWidget->addItem(tr("Sent to"), TransactionFilterProxy::TYPE(TransactionRecord::SendToAddress) | TransactionFilterProxy::TYPE(TransactionRecord::SendToOther)); - typeWidget->addItem(tr("To yourself"), TransactionFilterProxy::TYPE(TransactionRecord::SendToSelf)); typeWidget->addItem(tr("Mined"), TransactionFilterProxy::TYPE(TransactionRecord::Generated)); typeWidget->addItem(tr("Fee"), TransactionFilterProxy::TYPE(TransactionRecord::Fee)); typeWidget->addItem(tr("Issuance"), TransactionFilterProxy::TYPE(TransactionRecord::IssuedAsset)); From d4d45b6f0ae13403c22537e594a6051dad7c499a Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 8 Jan 2019 15:48:50 +0000 Subject: [PATCH 41/97] GUI: Use CT address for examples --- src/qt/guiutil.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 74522ea695..b917d88015 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -88,13 +88,15 @@ QFont fixedPitchFont() } // Just some dummy data to generate a convincing random-looking (but consistent) address -static const uint8_t dummydata[] = {0xeb,0x15,0x23,0x1d,0xfc,0xeb,0x60,0x92,0x58,0x86,0xb6,0x7d,0x06,0x52,0x99,0x92,0x59,0x15,0xae,0xb1,0x72,0xc0,0x66,0x47}; +static const uint8_t dummydata[33] = {3}; // Generate a dummy address with invalid CRC, starting with the network prefix. static std::string DummyAddress(const CChainParams ¶ms) { - std::vector sourcedata = params.Base58Prefix(CChainParams::PUBKEY_ADDRESS); - sourcedata.insert(sourcedata.end(), dummydata, dummydata + sizeof(dummydata)); + std::vector sourcedata; + CPubKey dummy_key(&dummydata[0], &dummydata[33]); + ScriptHash script_dest(uint160(), dummy_key); + DecodeBase58(EncodeDestination(script_dest), sourcedata); for(int i=0; i<256; ++i) { // Try every trailing byte std::string s = EncodeBase58(sourcedata.data(), sourcedata.data() + sourcedata.size()); if (!IsValidDestinationString(s)) { From 20479e4ad46f81582c93905ef5358095630455a3 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 8 Jan 2019 16:21:53 +0000 Subject: [PATCH 42/97] GUI: Receive: Replace "Copy URI" with "Copy address" --- src/qt/receivecoinsdialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index a7cc5da19e..82819aad5a 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -44,7 +44,7 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWid } // context menu actions - QAction *copyURIAction = new QAction(tr("Copy URI"), this); + QAction *copyURIAction = new QAction(tr("Copy address"), this); QAction *copyLabelAction = new QAction(tr("Copy label"), this); QAction *copyMessageAction = new QAction(tr("Copy message"), this); QAction *copyAmountAction = new QAction(tr("Copy amount"), this); @@ -272,7 +272,7 @@ void ReceiveCoinsDialog::copyURI() } const RecentRequestsTableModel * const submodel = model->getRecentRequestsTableModel(); - const QString uri = GUIUtil::formatBitcoinURI(submodel->entry(sel.row()).recipient); + const QString uri = submodel->entry(sel.row()).recipient.address; GUIUtil::setClipboard(uri); } From 25600f90dd5df5d3c41685d3f859a7d46bb0db94 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 8 Jan 2019 16:42:04 +0000 Subject: [PATCH 43/97] GUI: Receive: Remove URI-specific parameters for now --- src/qt/guiutil.cpp | 2 ++ src/qt/receivecoinsdialog.cpp | 10 ++++++++-- src/qt/recentrequeststablemodel.cpp | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index b917d88015..c3d984fb8b 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -122,6 +122,8 @@ void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent) bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out) { + return false; // TODO + // return if URI is not valid or is no bitcoin: URI if(!uri.isValid() || uri.scheme() != QString("bitcoin")) return false; diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index 82819aad5a..179aa0adbf 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -31,6 +31,11 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWid { ui->setupUi(this); + // Hide URI-specific fields, since we don't support URIs + ui->label_5->hide(); + ui->label->hide(); ui->reqAmount->hide(); + ui->label_3->hide(); ui->reqMessage->hide(); + if (!_platformStyle->getImagesOnButtons()) { ui->clearButton->setIcon(QIcon()); ui->receiveButton->setIcon(QIcon()); @@ -85,6 +90,8 @@ void ReceiveCoinsDialog::setModel(WalletModel *_model) tableView->setSelectionBehavior(QAbstractItemView::SelectRows); tableView->setSelectionMode(QAbstractItemView::ContiguousSelection); tableView->setColumnWidth(RecentRequestsTableModel::Date, DATE_COLUMN_WIDTH); + tableView->horizontalHeader()->setStretchLastSection(true); +#if 0 tableView->setColumnWidth(RecentRequestsTableModel::Label, LABEL_COLUMN_WIDTH); tableView->setColumnWidth(RecentRequestsTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH); @@ -93,7 +100,7 @@ void ReceiveCoinsDialog::setModel(WalletModel *_model) &ReceiveCoinsDialog::recentRequestsView_selectionChanged); // Last 2 columns are set by the columnResizingFixer, when the table geometry is ready. columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH, this); - +#endif if (model->wallet().getDefaultAddressType() == OutputType::BECH32) { ui->useBech32->setCheckState(Qt::Checked); } else { @@ -213,7 +220,6 @@ void ReceiveCoinsDialog::on_removeRequestButton_clicked() void ReceiveCoinsDialog::resizeEvent(QResizeEvent *event) { QWidget::resizeEvent(event); - columnResizingFixer->stretchColumnWidth(RecentRequestsTableModel::Message); } void ReceiveCoinsDialog::keyPressEvent(QKeyEvent *event) diff --git a/src/qt/recentrequeststablemodel.cpp b/src/qt/recentrequeststablemodel.cpp index 82ab48ac20..f0ee478523 100644 --- a/src/qt/recentrequeststablemodel.cpp +++ b/src/qt/recentrequeststablemodel.cpp @@ -24,7 +24,7 @@ RecentRequestsTableModel::RecentRequestsTableModel(WalletModel *parent) : addNewRequest(request); /* These columns must match the indices in the ColumnIndex enumeration */ - columns << tr("Date") << tr("Label") << tr("Message") << getAmountTitle(); + columns << tr("Date") << tr("Label"); connect(walletModel->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &RecentRequestsTableModel::updateDisplayUnit); } From 273aa76f8559da9ef542462eefee566b60c4c804 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 8 Jan 2019 17:26:43 +0000 Subject: [PATCH 44/97] GUI: Receive: Split up long addresses across multiple lines, in QR code image --- src/qt/receiverequestdialog.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp index c561d948be..fa597a9ce4 100644 --- a/src/qt/receiverequestdialog.cpp +++ b/src/qt/receiverequestdialog.cpp @@ -178,20 +178,29 @@ void ReceiveRequestDialog::update() } QRcode_free(code); - QImage qrAddrImage = QImage(QR_IMAGE_SIZE, QR_IMAGE_SIZE+20, QImage::Format_RGB32); + QFont font = GUIUtil::fixedPitchFont(); + font.setPixelSize(12); + QFontMetrics fm(font); + const int lines = (fm.width(info.address) / QR_IMAGE_SIZE) + 1; + QString split_address = info.address; + const int chars_per_line = (info.address.length() + lines - 1) / lines; + for (int i = 0; i < lines; ++i) { + split_address.insert((chars_per_line * i) + i, '\n'); + } + + QImage qrAddrImage = QImage(QR_IMAGE_SIZE, QR_IMAGE_SIZE + 16 + fm.height(), QImage::Format_RGB32); qrAddrImage.fill(0xffffff); QPainter painter(&qrAddrImage); painter.drawImage(0, 0, qrImage.scaled(QR_IMAGE_SIZE, QR_IMAGE_SIZE)); - QFont font = GUIUtil::fixedPitchFont(); QRect paddedRect = qrAddrImage.rect(); + paddedRect.setHeight(QR_IMAGE_SIZE + 8 + fm.height()); + painter.drawText(paddedRect, Qt::AlignBottom | Qt::AlignCenter | Qt::TextWordWrap, split_address); // calculate ideal font size qreal font_size = GUIUtil::calculateIdealFontSize(paddedRect.width() - 20, info.address, font); font.setPointSizeF(font_size); painter.setFont(font); - paddedRect.setHeight(QR_IMAGE_SIZE+12); - painter.drawText(paddedRect, Qt::AlignBottom|Qt::AlignCenter, info.address); painter.end(); ui->lblQRCode->setPixmap(QPixmap::fromImage(qrAddrImage)); From 82dfd3ff1a77ebb8b138771b2782c2af24381ccb Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 8 Jan 2019 17:27:07 +0000 Subject: [PATCH 45/97] GUI: Receive: Eliminate URI, and make QR code of just the address --- src/qt/receiverequestdialog.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp index fa597a9ce4..08ca9a1269 100644 --- a/src/qt/receiverequestdialog.cpp +++ b/src/qt/receiverequestdialog.cpp @@ -131,13 +131,11 @@ void ReceiveRequestDialog::update() target = info.address; setWindowTitle(tr("Request payment to %1").arg(target)); - QString uri = GUIUtil::formatBitcoinURI(info); + QString uri = info.address; ui->btnSaveAs->setEnabled(false); QString html; html += ""; html += ""+tr("Payment information")+"
"; - html += ""+tr("URI")+": "; - html += "" + GUIUtil::HtmlEscape(uri) + "
"; html += ""+tr("Address")+": " + GUIUtil::HtmlEscape(info.address) + "
"; if(info.amount) html += ""+tr("Amount")+": " + BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), info.amount) + "
"; From 20bf9c5cde51b65e202e8d57129ea253ff58324b Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 8 Jan 2019 17:31:34 +0000 Subject: [PATCH 46/97] GUI: Disable coin control (non-functional) --- src/qt/optionsdialog.cpp | 2 ++ src/qt/optionsmodel.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index b51322394f..20f8781285 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -33,6 +33,8 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) : { ui->setupUi(this); + ui->coinControlFeatures->setEnabled(false); + /* Main elements init */ ui->databaseCache->setMinimum(nMinDbCache); ui->databaseCache->setMaximum(nMaxDbCache); diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp index d04a2cf862..10ddf91b51 100644 --- a/src/qt/optionsmodel.cpp +++ b/src/qt/optionsmodel.cpp @@ -77,7 +77,7 @@ void OptionsModel::Init(bool resetSettings) if (!settings.contains("fCoinControlFeatures")) settings.setValue("fCoinControlFeatures", false); - fCoinControlFeatures = settings.value("fCoinControlFeatures", false).toBool(); + fCoinControlFeatures = false; // These are shared with the core or have a command-line parameter // and we want command-line parameters to overwrite the GUI settings. From 749e0a83c5961a5dbb10fbaf893781155ccc592a Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 8 Jan 2019 17:32:54 +0000 Subject: [PATCH 47/97] clientversion: Fix CLIENT_NAME to "Elements Core" --- src/clientversion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clientversion.cpp b/src/clientversion.cpp index 5d9eaea6d0..cfb6447bd1 100644 --- a/src/clientversion.cpp +++ b/src/clientversion.cpp @@ -12,7 +12,7 @@ * for both bitcoind and bitcoin-qt, to make it harder for attackers to * target servers or GUI users specifically. */ -const std::string CLIENT_NAME("Satoshi"); +const std::string CLIENT_NAME("Elements Core"); /** * Client version number From 335149944e2f9e4d752301c8f8c1a0997bce1071 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 1 Feb 2016 04:57:24 +0000 Subject: [PATCH 48/97] Reuse Windows ICO for Windows installer --- Makefile.am | 2 +- share/setup.nsi.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index f668b9e071..c6af20c526 100644 --- a/Makefile.am +++ b/Makefile.am @@ -50,7 +50,7 @@ DIST_SHARE = \ BIN_CHECKS=$(top_srcdir)/contrib/devtools/symbol-check.py \ $(top_srcdir)/contrib/devtools/security-check.py -WINDOWS_PACKAGING = $(top_srcdir)/share/pixmaps/bitcoin.ico \ +WINDOWS_PACKAGING = $(top_srcdir)/src/qt/res/icons/bitcoin.ico \ $(top_srcdir)/share/pixmaps/nsis-header.bmp \ $(top_srcdir)/share/pixmaps/nsis-wizard.bmp \ $(top_srcdir)/doc/README_windows.txt diff --git a/share/setup.nsi.in b/share/setup.nsi.in index b58a84e02d..bb0a9bfd31 100644 --- a/share/setup.nsi.in +++ b/share/setup.nsi.in @@ -10,7 +10,7 @@ SetCompressor /SOLID lzma !define URL @PACKAGE_URL@ # MUI Symbol Definitions -!define MUI_ICON "@abs_top_srcdir@/share/pixmaps/bitcoin.ico" +!define MUI_ICON "@abs_top_srcdir@/src/qt/res/icons/bitcoin.ico" !define MUI_WELCOMEFINISHPAGE_BITMAP "@abs_top_srcdir@/share/pixmaps/nsis-wizard.bmp" !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_RIGHT From 4fa10fe4e760c3d4235e5cf0844ba90d700fa175 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 5 Feb 2016 23:36:47 +0000 Subject: [PATCH 49/97] gitian: Dependencies for rendering icons icnsutils is needed on linux/win for generating the .icns in source tarball --- contrib/gitian-descriptors/gitian-linux.yml | 3 +++ contrib/gitian-descriptors/gitian-osx.yml | 1 + contrib/gitian-descriptors/gitian-win.yml | 3 +++ 3 files changed, 7 insertions(+) diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index 0bd08c4556..3e1b7d1f96 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -23,6 +23,9 @@ packages: - "gcc-8-multilib" - "binutils-gold" - "git" +- "icnsutils" +- "imagemagick" +- "librsvg2-bin" - "pkg-config" - "autoconf" - "libtool" diff --git a/contrib/gitian-descriptors/gitian-osx.yml b/contrib/gitian-descriptors/gitian-osx.yml index 057c2a345a..ef5bf99b3d 100644 --- a/contrib/gitian-descriptors/gitian-osx.yml +++ b/contrib/gitian-descriptors/gitian-osx.yml @@ -10,6 +10,7 @@ packages: - "curl" - "g++" - "git" +- "icnsutils" - "pkg-config" - "autoconf" - "librsvg2-bin" diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml index d12dcbffee..616183a3cb 100644 --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -9,6 +9,9 @@ packages: - "curl" - "g++" - "git" +- "icnsutils" +- "imagemagick" +- "librsvg2-bin" - "pkg-config" - "autoconf" - "libtool" From 06b30cfad8c6c185e50a0a3a414e9b19b479c4f5 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 8 Feb 2016 22:22:12 +0000 Subject: [PATCH 50/97] Travis: Include dependencies for building icons --- .travis.yml | 1 + .travis/test_04_install.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index eed2515e86..b771900afe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,7 @@ env: - CCACHE_DIR=$HOME/.ccache - BASE_OUTDIR=$TRAVIS_BUILD_DIR/out - SDK_URL=https://bitcoincore.org/depends-sources/sdks + - COMMON_PACKAGES="icnsutils librsvg2-bin imagemagick" - WINEDEBUG=fixme-all - DOCKER_PACKAGES="build-essential libtool autotools-dev automake pkg-config bsdmainutils curl git ca-certificates ccache" before_install: diff --git a/.travis/test_04_install.sh b/.travis/test_04_install.sh index ef595287b7..ef8928daa0 100755 --- a/.travis/test_04_install.sh +++ b/.travis/test_04_install.sh @@ -22,5 +22,5 @@ if [ -n "$DPKG_ADD_ARCH" ]; then fi travis_retry DOCKER_EXEC apt-get update -travis_retry DOCKER_EXEC apt-get install --no-install-recommends --no-upgrade -qq $PACKAGES $DOCKER_PACKAGES +travis_retry DOCKER_EXEC apt-get install --no-install-recommends --no-upgrade -qq $COMMON_PACKAGES $PACKAGES $DOCKER_PACKAGES From ec8e73a4d673bb329735d5a9cd78d0932f8bf128 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 8 Aug 2016 08:40:46 +0000 Subject: [PATCH 51/97] Make a modified copy of qrc file for VPATH builds --- src/Makefile.qt.include | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index 039d1d4831..5a727a3997 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -175,6 +175,7 @@ QT_MOC = \ QT_QRC_CPP = qt/qrc_bitcoin.cpp QT_QRC = qt/bitcoin.qrc +QT_QRC_BUILD = qt/qrc_bitcoin_build.qrc QT_QRC_LOCALE_CPP = qt/qrc_bitcoin_locale.cpp QT_QRC_LOCALE = qt/bitcoin_locale.qrc @@ -434,12 +435,15 @@ $(QT_QRC_LOCALE_CPP): $(QT_QRC_LOCALE) $(QT_QM) $(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@ @rm $(@D)/temp_$("$@" + +$(QT_QRC_CPP): $(QT_QRC_BUILD) $(QT_FORMS_H) $(RES_ICONS) $(RES_IMAGES) $(RES_MOVIES) $(PROTOBUF_H) @test -f $(RCC) $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin $< | \ $(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@ -CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno qt/temp_bitcoin_locale.qrc +CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno qt/temp_bitcoin_locale.qrc $(QT_QRC_BUILD) CLEANFILES += $(CLEAN_QT) From ff6a0a103c823d44a5da1bfa26da6c6e15f0ae62 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 5 Feb 2016 06:58:18 +0000 Subject: [PATCH 52/97] Render some icons when possible 8-bit icon is required to make builds deterministic --- Makefile.am | 7 +++-- configure.ac | 22 +++++++++++++-- share/setup.nsi.in | 2 +- src/Makefile.qt.include | 52 ++++++++++++++++++++++++++++++++---- src/qt/bitcoin.qrc | 4 +-- src/qt/res/bitcoin-qt-res.rc | 2 +- src/qt/res/src/bitcoin.svg | 2 +- 7 files changed, 77 insertions(+), 14 deletions(-) diff --git a/Makefile.am b/Makefile.am index c6af20c526..a637390678 100644 --- a/Makefile.am +++ b/Makefile.am @@ -33,7 +33,7 @@ OSX_BACKGROUND_IMAGE_DPIS=36 72 OSX_DSSTORE_GEN=$(top_srcdir)/contrib/macdeploy/custom_dsstore.py OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus OSX_FANCY_PLIST=$(top_srcdir)/contrib/macdeploy/fancy.plist -OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/bitcoin.icns +OSX_INSTALLER_ICONS=src/qt/res/rendered_icons/bitcoin.icns OSX_PLIST=$(top_builddir)/share/qt/Info.plist #not installed OSX_QT_TRANSLATIONS = da,de,es,hu,ru,uk,zh_CN,zh_TW @@ -50,7 +50,7 @@ DIST_SHARE = \ BIN_CHECKS=$(top_srcdir)/contrib/devtools/symbol-check.py \ $(top_srcdir)/contrib/devtools/security-check.py -WINDOWS_PACKAGING = $(top_srcdir)/src/qt/res/icons/bitcoin.ico \ +WINDOWS_PACKAGING = src/qt/res/rendered_icons/bitcoin.ico \ $(top_srcdir)/share/pixmaps/nsis-header.bmp \ $(top_srcdir)/share/pixmaps/nsis-wizard.bmp \ $(top_srcdir)/doc/README_windows.txt @@ -90,6 +90,9 @@ $(OSX_APP)/Contents/Info.plist: $(OSX_PLIST) $(MKDIR_P) $(@D) $(INSTALL_DATA) $< $@ +$(OSX_INSTALLER_ICONS): FORCE + $(MAKE) -C src $(patsubst src/%,%,$@) + $(OSX_APP)/Contents/Resources/bitcoin.icns: $(OSX_INSTALLER_ICONS) $(MKDIR_P) $(@D) $(INSTALL_DATA) $< $@ diff --git a/configure.ac b/configure.ac index 10b6cd1224..33630f9d9e 100644 --- a/configure.ac +++ b/configure.ac @@ -418,6 +418,17 @@ AC_ARG_WITH([daemon], [build_bitcoind=$withval], [build_bitcoind=yes]) +can_render_icons=yes +AC_PATH_PROGS([RSVG_CONVERT],[rsvg-convert rsvg],no) +AC_PATH_PROGS([IMAGEMAGICK_CONVERT],[convert],no) +AC_PATH_PROGS([PNG2ICNS],[png2icns],no) + +if test x$RSVG_CONVERT = xno; then + can_render_icons='rsvg-convert' +elif test x$IMAGEMAGICK_CONVERT = xno; then + can_render_icons='(ImageMagick) convert' +fi + use_pkgconfig=yes case $host in *mingw*) @@ -482,6 +493,10 @@ case $host in ;; *darwin*) + if test x$PNG2ICNS = xno; then + can_render_icons='png2icns' + fi + TARGET_OS=darwin LEVELDB_TARGET_FLAGS="-DOS_MACOSX" if test x$cross_compiling != xyes; then @@ -531,8 +546,6 @@ case $host in AC_PATH_TOOL([INSTALLNAMETOOL], [install_name_tool], install_name_tool) AC_PATH_TOOL([OTOOL], [otool], otool) AC_PATH_PROGS([GENISOIMAGE], [genisoimage mkisofs],genisoimage) - AC_PATH_PROGS([RSVG_CONVERT], [rsvg-convert rsvg],rsvg-convert) - AC_PATH_PROGS([IMAGEMAGICK_CONVERT], [convert],convert) AC_PATH_PROGS([TIFFCP], [tiffcp],tiffcp) dnl libtool will try to strip the static lib, which is a problem for @@ -582,6 +595,11 @@ case $host in ;; esac +AM_CONDITIONAL([CAN_RENDER_ICONS], [test x$can_render_icons = xyes]) +if test x$can_render_icons != xyes; then + AC_MSG_WARN([Couldn't find ${can_render_icons}; you won't get the Knots-branded Bitcoin icon]) +fi + if test x$use_pkgconfig = xyes; then m4_ifndef([PKG_PROG_PKG_CONFIG], [AC_MSG_ERROR(PKG_PROG_PKG_CONFIG macro not found. Please install pkg-config and re-run autogen.sh.)]) m4_ifdef([PKG_PROG_PKG_CONFIG], [ diff --git a/share/setup.nsi.in b/share/setup.nsi.in index bb0a9bfd31..3d2cbd743c 100644 --- a/share/setup.nsi.in +++ b/share/setup.nsi.in @@ -10,7 +10,7 @@ SetCompressor /SOLID lzma !define URL @PACKAGE_URL@ # MUI Symbol Definitions -!define MUI_ICON "@abs_top_srcdir@/src/qt/res/icons/bitcoin.ico" +!define MUI_ICON "@abs_top_srcdir@/src/qt/res/rendered_icons/bitcoin.ico" !define MUI_WELCOMEFINISHPAGE_BITMAP "@abs_top_srcdir@/share/pixmaps/nsis-wizard.bmp" !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_RIGHT diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index 5a727a3997..b7fc03213c 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -238,14 +238,23 @@ BITCOIN_QT_H = \ qt/walletview.h \ qt/winshutdownmonitor.h -RES_ICONS = \ +RES_RENDERED_ICON_SRC = qt/res/src/bitcoin.svg + +RES_RENDERED_ICONS = \ + qt/res/rendered_icons/about.png \ + qt/res/rendered_icons/bitcoin.ico \ + qt/res/rendered_icons/bitcoin1024.png + +RES_ALL_RENDERED_ICONS = $(RES_RENDERED_ICONS) \ + qt/res/rendered_icons/about.svg \ + $(patsubst %,qt/res/rendered_icons/bitcoin%.png,16 32 48 256 512 1024) \ + qt/res/rendered_icons/bitcoin.icns + +RES_ICONS = $(RES_RENDERED_ICONS) \ qt/res/icons/add.png \ qt/res/icons/address-book.png \ - qt/res/icons/about.png \ qt/res/icons/about_qt.png \ - qt/res/icons/bitcoin.ico \ qt/res/icons/bitcoin_testnet.ico \ - qt/res/icons/bitcoin.png \ qt/res/icons/chevron.png \ qt/res/icons/clock1.png \ qt/res/icons/clock2.png \ @@ -443,7 +452,7 @@ $(QT_QRC_CPP): $(QT_QRC_BUILD) $(QT_FORMS_H) $(RES_ICONS) $(RES_IMAGES) $(RES_MO $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin $< | \ $(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@ -CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno qt/temp_bitcoin_locale.qrc $(QT_QRC_BUILD) +CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno qt/temp_bitcoin_locale.qrc $(QT_QRC_BUILD) $(RES_ALL_RENDERED_ICONS) CLEANFILES += $(CLEAN_QT) @@ -469,3 +478,36 @@ moc_%.cpp: %.h @test -f $(LRELEASE) @$(MKDIR_P) $(@D) $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LRELEASE) -silent $< -qm $@ + +EXTRA_DIST += $(RES_RENDERED_ICON_SRC) + +if CAN_RENDER_ICONS + +qt/res/rendered_icons/about.png: qt/res/rendered_icons/about.svg + $(RSVG_CONVERT) -f png -d 142 -p 142 < $< | $(IMAGEMAGICK_CONVERT) - -crop 128x128+7+7 -colorspace Gray -strip $@ + +qt/res/rendered_icons/about.svg: qt/res/src/bitcoin.svg + @$(MKDIR_P) $(@D) + sed '/fill="white"/d;s/\(stop-color:\)#....../\1black/' < $< > $@ + +qt/res/rendered_icons/bitcoin%.png: qt/res/src/bitcoin.svg + @$(MKDIR_P) $(@D) + $(RSVG_CONVERT) -f png -d $* -p $* < $< > $@ + +# NOTE: ImageMagick will never convert transparent PNGs to 8-bit ICOs, but GIF is fine +qt/res/rendered_icons/bitcoin%d8.gif: qt/res/rendered_icons/bitcoin%.png + $(IMAGEMAGICK_CONVERT) $^ -colors 256 -channel A -threshold '50%' $@ + +qt/res/rendered_icons/bitcoin.icns: $(patsubst %,qt/res/rendered_icons/bitcoin%.png,256 512 1024 32 16) + $(PNG2ICNS) $@ $^ + +qt/res/rendered_icons/bitcoin.ico: qt/res/rendered_icons/bitcoin32d8.gif $(patsubst %,qt/res/rendered_icons/bitcoin%.png,256 64 48 32 20 16) + $(IMAGEMAGICK_CONVERT) $^ $@ + +else + +qt/res/rendered_icons/%: qt/res/icons/% + @$(MKDIR_P) $(@D) + cp $< $@ + +endif diff --git a/src/qt/bitcoin.qrc b/src/qt/bitcoin.qrc index fddc2a5685..1c9c9ba90a 100644 --- a/src/qt/bitcoin.qrc +++ b/src/qt/bitcoin.qrc @@ -1,6 +1,6 @@ - res/icons/bitcoin.png + res/rendered_icons/bitcoin1024.png res/icons/address-book.png res/icons/quit.png res/icons/send.png @@ -42,7 +42,7 @@ res/icons/debugwindow.png res/icons/open.png res/icons/info.png - res/icons/about.png + res/rendered_icons/about.png res/icons/about_qt.png res/icons/verify.png res/icons/warning.png diff --git a/src/qt/res/bitcoin-qt-res.rc b/src/qt/res/bitcoin-qt-res.rc index a915593f42..ff24e55451 100644 --- a/src/qt/res/bitcoin-qt-res.rc +++ b/src/qt/res/bitcoin-qt-res.rc @@ -1,4 +1,4 @@ -IDI_ICON1 ICON DISCARDABLE "icons/bitcoin.ico" +IDI_ICON1 ICON DISCARDABLE "rendered_icons/bitcoin.ico" IDI_ICON2 ICON DISCARDABLE "icons/bitcoin_testnet.ico" #include // needed for VERSIONINFO diff --git a/src/qt/res/src/bitcoin.svg b/src/qt/res/src/bitcoin.svg index 14cf0c5e11..d8da87394d 100644 --- a/src/qt/res/src/bitcoin.svg +++ b/src/qt/res/src/bitcoin.svg @@ -7,7 +7,7 @@ From d389515e82091a397e45d5249cdd1f73ab1b8da9 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 5 Feb 2016 18:53:43 +0000 Subject: [PATCH 53/97] Render NSIS wizard sidebar image --- Makefile.am | 4 ++-- share/setup.nsi.in | 4 ++-- src/Makefile.qt.include | 8 ++++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index a637390678..ff9c7c36af 100644 --- a/Makefile.am +++ b/Makefile.am @@ -52,7 +52,7 @@ BIN_CHECKS=$(top_srcdir)/contrib/devtools/symbol-check.py \ WINDOWS_PACKAGING = src/qt/res/rendered_icons/bitcoin.ico \ $(top_srcdir)/share/pixmaps/nsis-header.bmp \ - $(top_srcdir)/share/pixmaps/nsis-wizard.bmp \ + src/qt/res/rendered_icons/nsis-wizard.bmp \ $(top_srcdir)/doc/README_windows.txt OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) \ @@ -90,7 +90,7 @@ $(OSX_APP)/Contents/Info.plist: $(OSX_PLIST) $(MKDIR_P) $(@D) $(INSTALL_DATA) $< $@ -$(OSX_INSTALLER_ICONS): FORCE +src/qt/res/rendered_icons/%: FORCE $(MAKE) -C src $(patsubst src/%,%,$@) $(OSX_APP)/Contents/Resources/bitcoin.icns: $(OSX_INSTALLER_ICONS) diff --git a/share/setup.nsi.in b/share/setup.nsi.in index 3d2cbd743c..ebd5836f41 100644 --- a/share/setup.nsi.in +++ b/share/setup.nsi.in @@ -11,7 +11,7 @@ SetCompressor /SOLID lzma # MUI Symbol Definitions !define MUI_ICON "@abs_top_srcdir@/src/qt/res/rendered_icons/bitcoin.ico" -!define MUI_WELCOMEFINISHPAGE_BITMAP "@abs_top_srcdir@/share/pixmaps/nsis-wizard.bmp" +!define MUI_WELCOMEFINISHPAGE_BITMAP "@abs_top_builddir@/src/qt/res/rendered_icons/nsis-wizard.bmp" !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_RIGHT !define MUI_HEADERIMAGE_BITMAP "@abs_top_srcdir@/share/pixmaps/nsis-header.bmp" @@ -23,7 +23,7 @@ SetCompressor /SOLID lzma !define MUI_FINISHPAGE_RUN "$WINDIR\explorer.exe" !define MUI_FINISHPAGE_RUN_PARAMETERS $INSTDIR\@BITCOIN_GUI_NAME@@EXEEXT@ !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" -!define MUI_UNWELCOMEFINISHPAGE_BITMAP "@abs_top_srcdir@/share/pixmaps/nsis-wizard.bmp" +!define MUI_UNWELCOMEFINISHPAGE_BITMAP "@abs_top_builddir@/src/qt/res/rendered_icons/nsis-wizard.bmp" !define MUI_UNFINISHPAGE_NOAUTOCLOSE # Included files diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index b7fc03213c..a4b7aa1f18 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -247,8 +247,9 @@ RES_RENDERED_ICONS = \ RES_ALL_RENDERED_ICONS = $(RES_RENDERED_ICONS) \ qt/res/rendered_icons/about.svg \ - $(patsubst %,qt/res/rendered_icons/bitcoin%.png,16 32 48 256 512 1024) \ - qt/res/rendered_icons/bitcoin.icns + $(patsubst %,qt/res/rendered_icons/bitcoin%.png,16 32 48 256 290 512 1024) \ + qt/res/rendered_icons/bitcoin.icns \ + qt/res/rendered_icons/nsis-wizard.bmp RES_ICONS = $(RES_RENDERED_ICONS) \ qt/res/icons/add.png \ @@ -504,6 +505,9 @@ qt/res/rendered_icons/bitcoin.icns: $(patsubst %,qt/res/rendered_icons/bitcoin%. qt/res/rendered_icons/bitcoin.ico: qt/res/rendered_icons/bitcoin32d8.gif $(patsubst %,qt/res/rendered_icons/bitcoin%.png,256 64 48 32 20 16) $(IMAGEMAGICK_CONVERT) $^ $@ +qt/res/rendered_icons/nsis-wizard.bmp: qt/res/rendered_icons/bitcoin290.png + $(IMAGEMAGICK_CONVERT) $^ -crop 164x290+62+0 -border 0x12 -strip BMP3:$@ + else qt/res/rendered_icons/%: qt/res/icons/% From f60462d45dd6a2e1d013aa2ea359a1f1379f9c7f Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sat, 6 Feb 2016 07:28:33 +0000 Subject: [PATCH 54/97] Rather than clean generated icons, plan to distribute them --- configure.ac | 3 --- src/Makefile.am | 45 ++++++++++++++++++++++++++++++++++++ src/Makefile.qt.include | 51 +---------------------------------------- 3 files changed, 46 insertions(+), 53 deletions(-) diff --git a/configure.ac b/configure.ac index 33630f9d9e..b4a42fc772 100644 --- a/configure.ac +++ b/configure.ac @@ -596,9 +596,6 @@ case $host in esac AM_CONDITIONAL([CAN_RENDER_ICONS], [test x$can_render_icons = xyes]) -if test x$can_render_icons != xyes; then - AC_MSG_WARN([Couldn't find ${can_render_icons}; you won't get the Knots-branded Bitcoin icon]) -fi if test x$use_pkgconfig = xyes; then m4_ifndef([PKG_PROG_PKG_CONFIG], [AC_MSG_ERROR(PKG_PROG_PKG_CONFIG macro not found. Please install pkg-config and re-run autogen.sh.)]) diff --git a/src/Makefile.am b/src/Makefile.am index a1f4620f41..4c520a173a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -626,6 +626,51 @@ if EMBEDDED_LEVELDB include Makefile.leveldb.include endif +# Rendered icons must be here, not in Makefile.qt.include, since they are distributed with the source tarball + +RES_RENDERED_ICON_SRC = qt/res/src/bitcoin.svg + +RES_RENDERED_ICONS = \ + qt/res/rendered_icons/about.png \ + qt/res/rendered_icons/bitcoin.ico \ + qt/res/rendered_icons/bitcoin1024.png + +RES_ALL_RENDERED_ICONS = $(RES_RENDERED_ICONS) \ + qt/res/rendered_icons/about.svg \ + $(patsubst %,qt/res/rendered_icons/bitcoin%.png,16 32 48 256 290 512 1024) \ + qt/res/rendered_icons/bitcoin.icns \ + qt/res/rendered_icons/nsis-wizard.bmp + +EXTRA_DIST += $(RES_RENDERED_ICON_SRC) $(RES_ALL_RENDERED_ICONS) + +if CAN_RENDER_ICONS + +qt/res/rendered_icons/about.png: qt/res/rendered_icons/about.svg + $(RSVG_CONVERT) -f png -d 142 -p 142 < $< | $(IMAGEMAGICK_CONVERT) - -crop 128x128+7+7 -colorspace Gray -strip $@ + +qt/res/rendered_icons/about.svg: qt/res/src/bitcoin.svg + @$(MKDIR_P) $(@D) + sed '/fill="white"/d;s/\(stop-color:\)#....../\1black/' < $< > $@ + +qt/res/rendered_icons/bitcoin%.png: qt/res/src/bitcoin.svg + @$(MKDIR_P) $(@D) + $(RSVG_CONVERT) -f png -d $* -p $* < $< > $@ + +# NOTE: ImageMagick will never convert transparent PNGs to 8-bit ICOs, but GIF is fine +qt/res/rendered_icons/bitcoin%d8.gif: qt/res/rendered_icons/bitcoin%.png + $(IMAGEMAGICK_CONVERT) $^ -colors 256 -channel A -threshold '50%' $@ + +qt/res/rendered_icons/bitcoin.icns: $(patsubst %,qt/res/rendered_icons/bitcoin%.png,256 512 1024 32 16) + $(PNG2ICNS) $@ $^ + +qt/res/rendered_icons/bitcoin.ico: qt/res/rendered_icons/bitcoin32d8.gif $(patsubst %,qt/res/rendered_icons/bitcoin%.png,256 64 48 32 20 16) + $(IMAGEMAGICK_CONVERT) $^ $@ + +qt/res/rendered_icons/nsis-wizard.bmp: qt/res/rendered_icons/bitcoin290.png + $(IMAGEMAGICK_CONVERT) $^ -crop 164x290+62+0 -border 0x12 -strip BMP3:$@ + +endif + if ENABLE_TESTS include Makefile.test.include endif diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index a4b7aa1f18..3141ebc0e9 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -238,19 +238,6 @@ BITCOIN_QT_H = \ qt/walletview.h \ qt/winshutdownmonitor.h -RES_RENDERED_ICON_SRC = qt/res/src/bitcoin.svg - -RES_RENDERED_ICONS = \ - qt/res/rendered_icons/about.png \ - qt/res/rendered_icons/bitcoin.ico \ - qt/res/rendered_icons/bitcoin1024.png - -RES_ALL_RENDERED_ICONS = $(RES_RENDERED_ICONS) \ - qt/res/rendered_icons/about.svg \ - $(patsubst %,qt/res/rendered_icons/bitcoin%.png,16 32 48 256 290 512 1024) \ - qt/res/rendered_icons/bitcoin.icns \ - qt/res/rendered_icons/nsis-wizard.bmp - RES_ICONS = $(RES_RENDERED_ICONS) \ qt/res/icons/add.png \ qt/res/icons/address-book.png \ @@ -453,7 +440,7 @@ $(QT_QRC_CPP): $(QT_QRC_BUILD) $(QT_FORMS_H) $(RES_ICONS) $(RES_IMAGES) $(RES_MO $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin $< | \ $(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@ -CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno qt/temp_bitcoin_locale.qrc $(QT_QRC_BUILD) $(RES_ALL_RENDERED_ICONS) +CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno qt/temp_bitcoin_locale.qrc $(QT_QRC_BUILD) CLEANFILES += $(CLEAN_QT) @@ -479,39 +466,3 @@ moc_%.cpp: %.h @test -f $(LRELEASE) @$(MKDIR_P) $(@D) $(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LRELEASE) -silent $< -qm $@ - -EXTRA_DIST += $(RES_RENDERED_ICON_SRC) - -if CAN_RENDER_ICONS - -qt/res/rendered_icons/about.png: qt/res/rendered_icons/about.svg - $(RSVG_CONVERT) -f png -d 142 -p 142 < $< | $(IMAGEMAGICK_CONVERT) - -crop 128x128+7+7 -colorspace Gray -strip $@ - -qt/res/rendered_icons/about.svg: qt/res/src/bitcoin.svg - @$(MKDIR_P) $(@D) - sed '/fill="white"/d;s/\(stop-color:\)#....../\1black/' < $< > $@ - -qt/res/rendered_icons/bitcoin%.png: qt/res/src/bitcoin.svg - @$(MKDIR_P) $(@D) - $(RSVG_CONVERT) -f png -d $* -p $* < $< > $@ - -# NOTE: ImageMagick will never convert transparent PNGs to 8-bit ICOs, but GIF is fine -qt/res/rendered_icons/bitcoin%d8.gif: qt/res/rendered_icons/bitcoin%.png - $(IMAGEMAGICK_CONVERT) $^ -colors 256 -channel A -threshold '50%' $@ - -qt/res/rendered_icons/bitcoin.icns: $(patsubst %,qt/res/rendered_icons/bitcoin%.png,256 512 1024 32 16) - $(PNG2ICNS) $@ $^ - -qt/res/rendered_icons/bitcoin.ico: qt/res/rendered_icons/bitcoin32d8.gif $(patsubst %,qt/res/rendered_icons/bitcoin%.png,256 64 48 32 20 16) - $(IMAGEMAGICK_CONVERT) $^ $@ - -qt/res/rendered_icons/nsis-wizard.bmp: qt/res/rendered_icons/bitcoin290.png - $(IMAGEMAGICK_CONVERT) $^ -crop 164x290+62+0 -border 0x12 -strip BMP3:$@ - -else - -qt/res/rendered_icons/%: qt/res/icons/% - @$(MKDIR_P) $(@D) - cp $< $@ - -endif From 3f1764afd7c2e1e5259cdb270cfdd495840f7d76 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 8 Aug 2016 06:56:15 +0000 Subject: [PATCH 55/97] Generate bitcoin_testnet.ico using ImageMagick --- src/Makefile.am | 4 ++++ src/Makefile.qt.include | 1 - src/qt/res/bitcoin-qt-res.rc | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 4c520a173a..f97c32b735 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -633,6 +633,7 @@ RES_RENDERED_ICON_SRC = qt/res/src/bitcoin.svg RES_RENDERED_ICONS = \ qt/res/rendered_icons/about.png \ qt/res/rendered_icons/bitcoin.ico \ + qt/res/rendered_icons/bitcoin_testnet.ico \ qt/res/rendered_icons/bitcoin1024.png RES_ALL_RENDERED_ICONS = $(RES_RENDERED_ICONS) \ @@ -666,6 +667,9 @@ qt/res/rendered_icons/bitcoin.icns: $(patsubst %,qt/res/rendered_icons/bitcoin%. qt/res/rendered_icons/bitcoin.ico: qt/res/rendered_icons/bitcoin32d8.gif $(patsubst %,qt/res/rendered_icons/bitcoin%.png,256 64 48 32 20 16) $(IMAGEMAGICK_CONVERT) $^ $@ +qt/res/rendered_icons/bitcoin_testnet.ico: qt/res/rendered_icons/bitcoin.ico + $(IMAGEMAGICK_CONVERT) $^ -modulate 100,87,9 $@ + qt/res/rendered_icons/nsis-wizard.bmp: qt/res/rendered_icons/bitcoin290.png $(IMAGEMAGICK_CONVERT) $^ -crop 164x290+62+0 -border 0x12 -strip BMP3:$@ diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index 3141ebc0e9..d529169d0d 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -242,7 +242,6 @@ RES_ICONS = $(RES_RENDERED_ICONS) \ qt/res/icons/add.png \ qt/res/icons/address-book.png \ qt/res/icons/about_qt.png \ - qt/res/icons/bitcoin_testnet.ico \ qt/res/icons/chevron.png \ qt/res/icons/clock1.png \ qt/res/icons/clock2.png \ diff --git a/src/qt/res/bitcoin-qt-res.rc b/src/qt/res/bitcoin-qt-res.rc index ff24e55451..0f98506837 100644 --- a/src/qt/res/bitcoin-qt-res.rc +++ b/src/qt/res/bitcoin-qt-res.rc @@ -1,5 +1,5 @@ IDI_ICON1 ICON DISCARDABLE "rendered_icons/bitcoin.ico" -IDI_ICON2 ICON DISCARDABLE "icons/bitcoin_testnet.ico" +IDI_ICON2 ICON DISCARDABLE "rendered_icons/bitcoin_testnet.ico" #include // needed for VERSIONINFO #include "../../clientversion.h" // holds the needed client version information From 6879be70369cb1c273985671e6f190e43ab86e09 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 8 Jan 2019 17:55:24 +0000 Subject: [PATCH 56/97] GUI: Liquid branding --- src/Makefile.am | 15 +++++--- src/qt/res/src/bitcoin.svg | 71 ++++++++------------------------------ src/qt/splashscreen.cpp | 2 +- 3 files changed, 25 insertions(+), 63 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index f97c32b735..f8b615459d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -638,8 +638,9 @@ RES_RENDERED_ICONS = \ RES_ALL_RENDERED_ICONS = $(RES_RENDERED_ICONS) \ qt/res/rendered_icons/about.svg \ - $(patsubst %,qt/res/rendered_icons/bitcoin%.png,16 32 48 256 290 512 1024) \ + $(patsubst %,qt/res/rendered_icons/bitcoin%.png,16 32 48 256 512 1024) \ qt/res/rendered_icons/bitcoin.icns \ + qt/res/rendered_icons/nsis-wizard.svg \ qt/res/rendered_icons/nsis-wizard.bmp EXTRA_DIST += $(RES_RENDERED_ICON_SRC) $(RES_ALL_RENDERED_ICONS) @@ -647,11 +648,11 @@ EXTRA_DIST += $(RES_RENDERED_ICON_SRC) $(RES_ALL_RENDERED_ICONS) if CAN_RENDER_ICONS qt/res/rendered_icons/about.png: qt/res/rendered_icons/about.svg - $(RSVG_CONVERT) -f png -d 142 -p 142 < $< | $(IMAGEMAGICK_CONVERT) - -crop 128x128+7+7 -colorspace Gray -strip $@ + $(RSVG_CONVERT) -f png -d 142 -p 142 < $< | $(IMAGEMAGICK_CONVERT) - -crop 64x78+0+31 -bordercolor transparent -border 7x0 -colorspace Gray -strip $@ qt/res/rendered_icons/about.svg: qt/res/src/bitcoin.svg @$(MKDIR_P) $(@D) - sed '/fill="white"/d;s/\(stop-color:\)#....../\1black/' < $< > $@ + sed '/fill="#000"/d;s/fill="[^"]*"//g' < $< > $@ qt/res/rendered_icons/bitcoin%.png: qt/res/src/bitcoin.svg @$(MKDIR_P) $(@D) @@ -670,8 +671,12 @@ qt/res/rendered_icons/bitcoin.ico: qt/res/rendered_icons/bitcoin32d8.gif $(patsu qt/res/rendered_icons/bitcoin_testnet.ico: qt/res/rendered_icons/bitcoin.ico $(IMAGEMAGICK_CONVERT) $^ -modulate 100,87,9 $@ -qt/res/rendered_icons/nsis-wizard.bmp: qt/res/rendered_icons/bitcoin290.png - $(IMAGEMAGICK_CONVERT) $^ -crop 164x290+62+0 -border 0x12 -strip BMP3:$@ +qt/res/rendered_icons/nsis-wizard.svg: qt/res/src/bitcoin.svg + @$(MKDIR_P) $(@D) + sed '/fill="#000"/d' < $< > $@ + +qt/res/rendered_icons/nsis-wizard.bmp: qt/res/rendered_icons/nsis-wizard.svg + $(RSVG_CONVERT) -f png -d 360 -p 360 < $< | $(IMAGEMAGICK_CONVERT) - -crop 164x290+0+35 -border 0x12 -strip BMP3:$@ endif diff --git a/src/qt/res/src/bitcoin.svg b/src/qt/res/src/bitcoin.svg index d8da87394d..082578d299 100644 --- a/src/qt/res/src/bitcoin.svg +++ b/src/qt/res/src/bitcoin.svg @@ -1,58 +1,15 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index 1eff4f6b65..ed8a5fd1b9 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -69,7 +69,7 @@ SplashScreen::SplashScreen(interfaces::Node& node, Qt::WindowFlags f, const Netw pixPaint.fillRect(rGradient, gradient); // draw the bitcoin icon, expected size of PNG: 1024x1024 - QRect rectIcon(QPoint(-150,-122), QSize(430,430)); + QRect rectIcon(QPoint(32,-32), QSize(pixmap.size().height()+64,pixmap.size().height()+64)); const QSize requiredSize(1024,1024); QPixmap icon(networkStyle->getAppIcon().pixmap(requiredSize)); From 9ee46291d5975831168b0670a265a979568f9221 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 24 Jan 2019 05:11:33 +0000 Subject: [PATCH 57/97] GUI: Add "L-" prefix to Bitcoin units --- src/qt/bitcoinunits.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qt/bitcoinunits.cpp b/src/qt/bitcoinunits.cpp index 8aa1fdba4d..f96428551e 100644 --- a/src/qt/bitcoinunits.cpp +++ b/src/qt/bitcoinunits.cpp @@ -42,10 +42,10 @@ QString BitcoinUnits::longName(int unit) { switch(unit) { - case BTC: return QString("BTC"); - case mBTC: return QString("mBTC"); - case uBTC: return QString::fromUtf8("µBTC (bits)"); - case SAT: return QString("Satoshi (sat)"); + case BTC: return QString("L-BTC"); + case mBTC: return QString("mL-BTC"); + case uBTC: return QString::fromUtf8("μL-BTC"); + case SAT: return QString("Satoshi (L-sat)"); default: return QString("???"); } } From 4c678d1e3ab3bf7eb0bc920f9b80d65b9cf23713 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 24 Jan 2019 05:24:50 +0000 Subject: [PATCH 58/97] GUI: Receive: Eliminate "Copy URI" from receive request dialog --- src/qt/receiverequestdialog.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp index 08ca9a1269..8813bf4dd4 100644 --- a/src/qt/receiverequestdialog.cpp +++ b/src/qt/receiverequestdialog.cpp @@ -92,6 +92,8 @@ ReceiveRequestDialog::ReceiveRequestDialog(QWidget *parent) : { ui->setupUi(this); + ui->btnCopyURI->setVisible(false); + #ifndef USE_QRCODE ui->btnSaveAs->setVisible(false); ui->lblQRCode->setVisible(false); From 795f7f1a5d7deee0900be7847ba79c9ea9a59117 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 24 Jan 2019 08:22:12 +0000 Subject: [PATCH 59/97] Gitian: Use newer librsvg so Liquid logo renders correctly --- contrib/gitian-descriptors/gitian-linux.yml | 4 ++++ contrib/gitian-descriptors/gitian-osx.yml | 4 ++++ contrib/gitian-descriptors/gitian-win.yml | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index 3e1b7d1f96..52f0ce400c 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -62,6 +62,10 @@ script: | mkdir -p ${BASE_CACHE} ${SOURCES_PATH} fi + ls librsvg*.deb || wget http://mirrors.kernel.org/ubuntu/pool/main/libr/librsvg/librsvg2-2_2.40.13-3_amd64.deb + dpkg -x librsvg*.deb new-rsvg + export LD_LIBRARY_PATH="$(echo $PWD/new-rsvg/usr/lib/*/)" + function create_global_faketime_wrappers { for prog in ${FAKETIME_PROGS}; do echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${prog} diff --git a/contrib/gitian-descriptors/gitian-osx.yml b/contrib/gitian-descriptors/gitian-osx.yml index ef5bf99b3d..399a51ae0f 100644 --- a/contrib/gitian-descriptors/gitian-osx.yml +++ b/contrib/gitian-descriptors/gitian-osx.yml @@ -55,6 +55,10 @@ script: | export ZERO_AR_DATE=1 + ls librsvg*.deb || wget http://mirrors.kernel.org/ubuntu/pool/main/libr/librsvg/librsvg2-2_2.40.13-3_amd64.deb + dpkg -x librsvg*.deb new-rsvg + export LD_LIBRARY_PATH="$(echo $PWD/new-rsvg/usr/lib/*/)" + function create_global_faketime_wrappers { for prog in ${FAKETIME_PROGS}; do echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${prog} diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml index 616183a3cb..2a0c5243e4 100644 --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -51,6 +51,10 @@ script: | mkdir -p ${BASE_CACHE} ${SOURCES_PATH} fi + ls librsvg*.deb || wget http://mirrors.kernel.org/ubuntu/pool/main/libr/librsvg/librsvg2-2_2.40.13-3_amd64.deb + dpkg -x librsvg*.deb new-rsvg + export LD_LIBRARY_PATH="$(echo $PWD/new-rsvg/usr/lib/*/)" + function create_global_faketime_wrappers { for prog in ${FAKETIME_PROGS}; do echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${prog} From 08aea0ecc8cb82747432f43bff0f6ecbd1bc5767 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 10 Apr 2019 09:59:30 -0400 Subject: [PATCH 60/97] configure: Rename binary to elements name --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index b4a42fc772..f020551eb6 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([build-aux/m4]) BITCOIN_DAEMON_NAME=elementsd -BITCOIN_GUI_NAME=bitcoin-qt +BITCOIN_GUI_NAME=elements-qt BITCOIN_CLI_NAME=elements-cli BITCOIN_TX_NAME=elements-tx From bbb5a4cc3f8d707cf3020c518875a63b00d027a0 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 7 Feb 2019 13:03:14 +0000 Subject: [PATCH 61/97] Gitian: Remove libconsensus from Windows/macOS builds --- contrib/gitian-descriptors/gitian-osx.yml | 3 --- contrib/gitian-descriptors/gitian-win.yml | 5 ----- 2 files changed, 8 deletions(-) diff --git a/contrib/gitian-descriptors/gitian-osx.yml b/contrib/gitian-descriptors/gitian-osx.yml index 399a51ae0f..4b0798a5c7 100644 --- a/contrib/gitian-descriptors/gitian-osx.yml +++ b/contrib/gitian-descriptors/gitian-osx.yml @@ -161,9 +161,6 @@ script: | ${WRAP_DIR}/dmg dmg "${OSX_VOLNAME}.dmg" ${OUTDIR}/${DISTNAME}-osx-unsigned.dmg cd installed - find . -name "lib*.la" -delete - find . -name "lib*.a" -delete - rm -rf ${DISTNAME}/lib/pkgconfig find ${DISTNAME} | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-${i}.tar.gz cd ../../ done diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml index 2a0c5243e4..60ccda7cd8 100644 --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -166,12 +166,7 @@ script: | rename 's/-setup\.exe$/-setup-unsigned.exe/' *-setup.exe cp -f elements-*setup*.exe $OUTDIR/ cd installed - mv ${DISTNAME}/bin/*.dll ${DISTNAME}/lib/ - find . -name "lib*.la" -delete - find . -name "lib*.a" -delete - rm -rf ${DISTNAME}/lib/pkgconfig find ${DISTNAME}/bin -type f -executable -exec ${i}-objcopy --only-keep-debug {} {}.dbg \; -exec ${i}-strip -s {} \; -exec ${i}-objcopy --add-gnu-debuglink={}.dbg {} \; - find ${DISTNAME}/lib -type f -exec ${i}-objcopy --only-keep-debug {} {}.dbg \; -exec ${i}-strip -s {} \; -exec ${i}-objcopy --add-gnu-debuglink={}.dbg {} \; find ${DISTNAME} -not -name "*.dbg" -type f | sort | zip -X@ ${OUTDIR}/${DISTNAME}-${i}.zip find ${DISTNAME} -name "*.dbg" -type f | sort | zip -X@ ${OUTDIR}/${DISTNAME}-${i}-debug.zip cd ../../ From 954f7758ae8dc46ce3340f00ff4e63556d62717b Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 22 Feb 2019 21:44:13 +0000 Subject: [PATCH 62/97] Bugfix: GUI: Receive: Don't try to update label for non-existent Amount column Fixes: https://github.com/greenaddress/elements/issues/3 --- src/qt/recentrequeststablemodel.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/qt/recentrequeststablemodel.cpp b/src/qt/recentrequeststablemodel.cpp index f0ee478523..ba680fc278 100644 --- a/src/qt/recentrequeststablemodel.cpp +++ b/src/qt/recentrequeststablemodel.cpp @@ -115,8 +115,6 @@ QVariant RecentRequestsTableModel::headerData(int section, Qt::Orientation orien /** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */ void RecentRequestsTableModel::updateAmountColumnTitle() { - columns[Amount] = getAmountTitle(); - Q_EMIT headerDataChanged(Qt::Horizontal,Amount,Amount); } /** Gets title for amount column including current display unit if optionsModel reference available. */ From 1f0b6886b749bdcb4ce7b17b3302d8b684850912 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 22 Feb 2019 22:53:58 +0000 Subject: [PATCH 63/97] GUI: Emit BitcoinAmountField::valueChanged when unit changes even if the current value is invalid --- src/qt/bitcoinamountfield.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp index 83ecb44002..83ee3fd347 100644 --- a/src/qt/bitcoinamountfield.cpp +++ b/src/qt/bitcoinamountfield.cpp @@ -133,9 +133,7 @@ class AmountSpinBox: public QAbstractSpinBox if (!was_pegged) { // Leave the text as-is, if it's valid value(&valid); - if (valid) { - Q_EMIT valueChanged(); - } else { + if (!valid) { clear(); } } else @@ -143,6 +141,7 @@ class AmountSpinBox: public QAbstractSpinBox setValue(val); else clear(); + Q_EMIT valueChanged(); } void setSingleStep(const CAmount& step) From 36ebb131dc308c225af0eeb2fca8f40b65ec61e6 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 22 Feb 2019 22:54:51 +0000 Subject: [PATCH 64/97] GUI: Disable "Subtract fee from amount" checkbox when a non-pegged asset is selected Fixes: https://github.com/greenaddress/elements/issues/4 --- src/qt/sendcoinsentry.cpp | 12 ++++++++++++ src/qt/sendcoinsentry.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index d3ee221107..ca0c886c5c 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -44,6 +44,7 @@ SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *par // Connect signals connect(ui->payAmount, &BitcoinAmountField::valueChanged, this, &SendCoinsEntry::payAmountChanged); connect(ui->checkboxSubtractFeeFromAmount, &QCheckBox::toggled, this, &SendCoinsEntry::subtractFeeFromAmountChanged); + connect(ui->payAmount, SIGNAL(valueChanged()), this, SLOT(payAmountChangedInternal())); connect(ui->deleteButton, &QPushButton::clicked, this, &SendCoinsEntry::deleteClicked); connect(ui->deleteButton_is, &QPushButton::clicked, this, &SendCoinsEntry::deleteClicked); connect(ui->deleteButton_s, &QPushButton::clicked, this, &SendCoinsEntry::deleteClicked); @@ -115,6 +116,17 @@ void SendCoinsEntry::clear() updateDisplayUnit(); } +void SendCoinsEntry::payAmountChangedInternal() +{ + const auto send_assets = ui->payAmount->fullValue(); + if (send_assets.first == Params().GetConsensus().pegged_asset) { + ui->checkboxSubtractFeeFromAmount->setEnabled(true); + } else { + ui->checkboxSubtractFeeFromAmount->setCheckState(Qt::Unchecked); + ui->checkboxSubtractFeeFromAmount->setEnabled(false); + } +} + void SendCoinsEntry::checkSubtractFeeFromAmount() { ui->checkboxSubtractFeeFromAmount->setChecked(true); diff --git a/src/qt/sendcoinsentry.h b/src/qt/sendcoinsentry.h index 2588685bd8..581b3095d9 100644 --- a/src/qt/sendcoinsentry.h +++ b/src/qt/sendcoinsentry.h @@ -58,6 +58,7 @@ public Q_SLOTS: void subtractFeeFromAmountChanged(); private Q_SLOTS: + void payAmountChangedInternal(); void deleteClicked(); void useAvailableBalanceClicked(); void on_payTo_textChanged(const QString &address); From d522775b80985c51ca8733849a785d74af8a9316 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 22 Feb 2019 23:04:02 +0000 Subject: [PATCH 65/97] Bugfix: GUI: Ensure negative symbol is before whole number in GUIUtil::formatAssetAmount Fixes: https://github.com/greenaddress/elements/issues/5 --- src/qt/guiutil.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index c3d984fb8b..27f714de7f 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -788,9 +788,13 @@ QString formatAssetAmount(const CAsset& asset, const CAmount& amount, const int } } - qlonglong whole = amount / 100000000; - qlonglong fraction = amount % 100000000; + qlonglong abs = qAbs(amount); + qlonglong whole = abs / 100000000; + qlonglong fraction = abs % 100000000; QString str = QString("%1").arg(whole); + if (amount < 0) { + str.insert(0, '-'); + } if (fraction) { str += QString(".%1").arg(fraction, 8, 10, QLatin1Char('0')); } From 680265806b3cbe22505fc0cc6306edac222b89de Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sat, 23 Feb 2019 03:00:11 +0000 Subject: [PATCH 66/97] GUI: Adjust blockchain and chainstate sizes in Intro Fixes: https://github.com/greenaddress/elements/issues/1 --- src/qt/intro.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index b19cc17a4d..94885d59da 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -23,9 +23,9 @@ static const uint64_t GB_BYTES = 1000000000LL; /* Minimum free space (in GB) needed for data directory */ -constexpr uint64_t BLOCK_CHAIN_SIZE = 220; +constexpr uint64_t BLOCK_CHAIN_SIZE = 1; /* Minimum free space (in GB) needed for data directory when pruned; Does not include prune target */ -static const uint64_t CHAIN_STATE_SIZE = 3; +static const uint64_t CHAIN_STATE_SIZE = 0; /* Total required space (in GB) depending on user choice (prune, not prune) */ static uint64_t requiredSpace; From 0a3f589058875555a278899fc99b3c642ae5cc06 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sat, 23 Feb 2019 11:32:03 +0000 Subject: [PATCH 67/97] init: If bitcoind is unreachable, explain where the user can get it Fixes: https://github.com/greenaddress/elements/issues/2 --- src/init.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/init.cpp b/src/init.cpp index dc7a0d39d0..991502320a 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1874,6 +1874,8 @@ bool AppInitMain() uiInterface.InitMessage(_("Awaiting mainchain RPC warmup")); if (!MainchainRPCCheck(true)) { //Initial check, fail immediately return InitError(_("ERROR: elementsd is set to verify pegins but cannot get valid response from the mainchain daemon. Please check debug.log for more information.")); + + "\n\n" + + strprintf(_("If you haven't setup a %s please get the latest stable version from %s or if you do not need to validate pegins set in your elements configuration %s"), "bitcoind", "https://bitcoincore.org/en/download/", "validatepegin=0")); } uiInterface.InitMessage(_("Done loading")); From ce752c0bd0399eccad19e1b6d7bda211d9bdd7d7 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sat, 23 Feb 2019 11:38:19 +0000 Subject: [PATCH 68/97] GUI: Remove access to unported "transaction details" display --- src/qt/transactionview.cpp | 1 - src/qt/walletview.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 4d0a0dc8a4..d70a0eea4f 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -201,7 +201,6 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa contextMenu->addAction(copyTxIDAction); contextMenu->addAction(copyTxHexAction); contextMenu->addAction(copyTxPlainText); - contextMenu->addAction(showDetailsAction); contextMenu->addSeparator(); contextMenu->addAction(bumpFeeAction); contextMenu->addAction(abandonAction); diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index 053e951921..0d9ccbf86a 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -72,7 +72,6 @@ WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent): // Highlight transaction after send connect(sendCoinsPage, &SendCoinsDialog::coinsSent, transactionView, static_cast(&TransactionView::focusTransaction)); - // Clicking on "Export" allows to export the transaction list connect(exportButton, &QPushButton::clicked, transactionView, &TransactionView::exportClicked); From d82eee9d2fb4da475325b9f67776632dd040c2d3 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Wed, 27 Feb 2019 19:19:36 +0000 Subject: [PATCH 69/97] GUI: Add liquidv1 network style --- src/qt/networkstyle.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qt/networkstyle.cpp b/src/qt/networkstyle.cpp index 25dec23c6e..8942de3d73 100644 --- a/src/qt/networkstyle.cpp +++ b/src/qt/networkstyle.cpp @@ -19,6 +19,7 @@ static const struct { } network_styles[] = { {"main", QAPP_APP_NAME_DEFAULT, 0, 0}, {"test", QAPP_APP_NAME_TESTNET, 70, 30}, + {CHAINPARAMS_LIQUIDV1, "Liquid-Qt-liquidv1", 0, 0}, {"regtest", QAPP_APP_NAME_TESTNET, 160, 30} }; static const unsigned network_styles_count = sizeof(network_styles)/sizeof(*network_styles); From 737e99a35afa48b5cc908675be8a0d8fec8cbdf1 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Wed, 27 Feb 2019 19:33:31 +0000 Subject: [PATCH 70/97] GUI: Make liquidv1 the "normal title bar" style --- src/qt/networkstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/networkstyle.cpp b/src/qt/networkstyle.cpp index 8942de3d73..8b9624b3c8 100644 --- a/src/qt/networkstyle.cpp +++ b/src/qt/networkstyle.cpp @@ -80,7 +80,7 @@ NetworkStyle::NetworkStyle(const QString &_appName, const int iconColorHueShift, const NetworkStyle* NetworkStyle::instantiate(const std::string& networkId) { - std::string titleAddText = networkId == CBaseChainParams::MAIN ? "" : strprintf("[%s]", networkId); + std::string titleAddText = networkId == CBaseChainParams::LIQUIDV1 ? "" : strprintf("[%s]", networkId); for (unsigned x=0; x Date: Thu, 28 Feb 2019 12:07:46 +0000 Subject: [PATCH 71/97] GUI: Replace "Bitcoin" with "Liquid" in appropriate strings --- src/qt/addressbookpage.cpp | 4 ++-- src/qt/bitcoingui.cpp | 16 ++++++++-------- src/qt/editaddressdialog.cpp | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/qt/addressbookpage.cpp b/src/qt/addressbookpage.cpp index 26bdf60d4a..d7c88fbcf8 100644 --- a/src/qt/addressbookpage.cpp +++ b/src/qt/addressbookpage.cpp @@ -102,12 +102,12 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode, switch(tab) { case SendingTab: - ui->labelExplanation->setText(tr("These are your Bitcoin addresses for sending payments. Always check the amount and the receiving address before sending coins.")); + ui->labelExplanation->setText(tr("These are your %1 addresses for sending payments. Always check the amount and the receiving address before sending coins.").arg("Liquid")); ui->deleteAddress->setVisible(true); ui->newAddress->setVisible(true); break; case ReceivingTab: - ui->labelExplanation->setText(tr("These are your Bitcoin addresses for receiving payments. It is recommended to use a new receiving address for each transaction.")); + ui->labelExplanation->setText(tr("These are your %1 addresses for receiving payments. It is recommended to use a new receiving address for each transaction.").arg("Liquid")); ui->deleteAddress->setVisible(false); ui->newAddress->setVisible(false); break; diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 51aff08c42..c97be1595b 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -242,7 +242,7 @@ void BitcoinGUI::createActions() tabGroup->addAction(overviewAction); sendCoinsAction = new QAction(platformStyle->SingleColorIcon(":/icons/send"), tr("&Send"), this); - sendCoinsAction->setStatusTip(tr("Send coins to a Bitcoin address")); + sendCoinsAction->setStatusTip(tr("Send coins to a %1 address").arg("Liquid")); sendCoinsAction->setToolTip(sendCoinsAction->statusTip()); sendCoinsAction->setCheckable(true); sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2)); @@ -253,7 +253,7 @@ void BitcoinGUI::createActions() sendCoinsMenuAction->setToolTip(sendCoinsMenuAction->statusTip()); receiveCoinsAction = new QAction(platformStyle->SingleColorIcon(":/icons/receiving_addresses"), tr("&Receive"), this); - receiveCoinsAction->setStatusTip(tr("Request payments (generates QR codes and bitcoin: URIs)")); + receiveCoinsAction->setStatusTip(tr("Request payments (generates QR codes and %1 addresses)").arg("Liquid")); receiveCoinsAction->setToolTip(receiveCoinsAction->statusTip()); receiveCoinsAction->setCheckable(true); receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3)); @@ -313,9 +313,9 @@ void BitcoinGUI::createActions() changePassphraseAction = new QAction(platformStyle->TextColorIcon(":/icons/key"), tr("&Change Passphrase..."), this); changePassphraseAction->setStatusTip(tr("Change the passphrase used for wallet encryption")); signMessageAction = new QAction(platformStyle->TextColorIcon(":/icons/edit"), tr("Sign &message..."), this); - signMessageAction->setStatusTip(tr("Sign messages with your Bitcoin addresses to prove you own them")); + signMessageAction->setStatusTip(tr("Sign messages with your %1 addresses to prove you own them").arg("Liquid")); verifyMessageAction = new QAction(platformStyle->TextColorIcon(":/icons/verify"), tr("&Verify message..."), this); - verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified Bitcoin addresses")); + verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified %1 addresses").arg("Liquid")); openRPCConsoleAction = new QAction(platformStyle->TextColorIcon(":/icons/debugwindow"), tr("&Debug window"), this); openRPCConsoleAction->setStatusTip(tr("Open debugging and diagnostic console")); @@ -328,11 +328,11 @@ void BitcoinGUI::createActions() usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels")); openAction = new QAction(platformStyle->TextColorIcon(":/icons/open"), tr("Open &URI..."), this); - openAction->setStatusTip(tr("Open a bitcoin: URI or payment request")); + openAction->setStatusTip(tr("Open a payment request")); showHelpMessageAction = new QAction(platformStyle->TextColorIcon(":/icons/info"), tr("&Command-line options"), this); showHelpMessageAction->setMenuRole(QAction::NoRole); - showHelpMessageAction->setStatusTip(tr("Show the %1 help message to get a list with possible Bitcoin command-line options").arg(tr(PACKAGE_NAME))); + showHelpMessageAction->setStatusTip(tr("Show the %1 help message to get a list with possible command-line options").arg(tr(PACKAGE_NAME))); connect(quitAction, &QAction::triggered, qApp, QApplication::quit); connect(aboutAction, &QAction::triggered, this, &BitcoinGUI::aboutClicked); @@ -739,7 +739,7 @@ void BitcoinGUI::updateNetworkState() QString tooltip; if (m_node.getNetworkActive()) { - tooltip = tr("%n active connection(s) to Bitcoin network", "", count) + QString(".
") + tr("Click to disable network activity."); + tooltip = tr("%n active connection(s) to %1 network", "", count).arg("Liquid") + QString(".
") + tr("Click to disable network activity."); } else { tooltip = tr("Network activity disabled.") + QString("
") + tr("Click to enable network activity again."); icon = ":/icons/network_disabled"; @@ -894,7 +894,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer void BitcoinGUI::message(const QString &title, const QString &message, unsigned int style, bool *ret) { - QString strTitle = tr("Bitcoin"); // default title + QString strTitle = tr(PACKAGE_NAME); // default title // Default to information icon int nMBoxIcon = QMessageBox::Information; int nNotifyIcon = Notificator::Information; diff --git a/src/qt/editaddressdialog.cpp b/src/qt/editaddressdialog.cpp index 0b0b96b30c..01b946c16c 100644 --- a/src/qt/editaddressdialog.cpp +++ b/src/qt/editaddressdialog.cpp @@ -108,7 +108,7 @@ void EditAddressDialog::accept() break; case AddressTableModel::INVALID_ADDRESS: QMessageBox::warning(this, windowTitle(), - tr("The entered address \"%1\" is not a valid Bitcoin address.").arg(ui->addressEdit->text()), + tr("The entered address \"%1\" is not a valid %2 address.").arg(ui->addressEdit->text()).arg("Liquid"), QMessageBox::Ok, QMessageBox::Ok); break; case AddressTableModel::DUPLICATE_ADDRESS: From be7527f50d377798e24fbcdee4541c428ea2f539 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 28 Feb 2019 12:18:09 +0000 Subject: [PATCH 72/97] GUI: Replace "Bitcoin" with "Liquid" in appropriate strings --- src/qt/forms/modaloverlay.ui | 4 ++-- src/qt/forms/optionsdialog.ui | 6 +++--- src/qt/forms/overviewpage.ui | 4 ++-- src/qt/forms/sendcoinsentry.ui | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/qt/forms/modaloverlay.ui b/src/qt/forms/modaloverlay.ui index b5a69c578d..03ccb658e1 100644 --- a/src/qt/forms/modaloverlay.ui +++ b/src/qt/forms/modaloverlay.ui @@ -130,7 +130,7 @@ QLabel { color: rgb(40,40,40); } - Recent transactions may not yet be visible, and therefore your wallet's balance might be incorrect. This information will be correct once your wallet has finished synchronizing with the bitcoin network, as detailed below. + Recent transactions may not yet be visible, and therefore your wallet's balance might be incorrect. This information will be correct once your wallet has finished synchronizing with the Liquid network, as detailed below. Qt::RichText @@ -149,7 +149,7 @@ QLabel { color: rgb(40,40,40); }
- Attempting to spend bitcoins that are affected by not-yet-displayed transactions will not be accepted by the network. + Attempting to spend assets that are affected by not-yet-displayed transactions will not be accepted by the network. Qt::RichText diff --git a/src/qt/forms/optionsdialog.ui b/src/qt/forms/optionsdialog.ui index 8f34e6bc82..8bde182d4f 100644 --- a/src/qt/forms/optionsdialog.ui +++ b/src/qt/forms/optionsdialog.ui @@ -252,7 +252,7 @@ - Automatically open the Bitcoin client port on the router. This only works when your router supports UPnP and it is enabled. + Automatically open the Liquid client port on the router. This only works when your router supports UPnP and it is enabled. Map port using &UPnP @@ -272,7 +272,7 @@ - Connect to the Bitcoin network through a SOCKS5 proxy. + Connect to the Liquid network through a SOCKS5 proxy. &Connect through SOCKS5 proxy (default proxy): @@ -459,7 +459,7 @@ - Connect to the Bitcoin network through a separate SOCKS5 proxy for Tor hidden services. + Connect to the Liquid network through a separate SOCKS5 proxy for Tor hidden services. Use separate SOCKS&5 proxy to reach peers via Tor hidden services: diff --git a/src/qt/forms/overviewpage.ui b/src/qt/forms/overviewpage.ui index 5bad949f7b..c2f80ac60c 100644 --- a/src/qt/forms/overviewpage.ui +++ b/src/qt/forms/overviewpage.ui @@ -73,7 +73,7 @@ - The displayed information may be out of date. Your wallet automatically synchronizes with the Bitcoin network after a connection is established, but this process has not completed yet. + The displayed information may be out of date. Your wallet automatically synchronizes with the Liquid network after a connection is established, but this process has not completed yet. @@ -471,7 +471,7 @@ - The displayed information may be out of date. Your wallet automatically synchronizes with the Bitcoin network after a connection is established, but this process has not completed yet. + The displayed information may be out of date. Your wallet automatically synchronizes with the Liquid network after a connection is established, but this process has not completed yet. diff --git a/src/qt/forms/sendcoinsentry.ui b/src/qt/forms/sendcoinsentry.ui index 3c699abc6a..9fb9263a39 100644 --- a/src/qt/forms/sendcoinsentry.ui +++ b/src/qt/forms/sendcoinsentry.ui @@ -57,7 +57,7 @@ - The Bitcoin address to send the payment to + The Liquid address to send the payment to From 33f54fb53a96100a1e6e7ce7f5f947e4810c4ca0 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 28 Feb 2019 12:21:04 +0000 Subject: [PATCH 73/97] GUI: Remove unnecessary references to Bitcoin --- src/qt/forms/sendcoinsdialog.ui | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui index 6b31ddea90..11eb5fbe33 100644 --- a/src/qt/forms/sendcoinsdialog.ui +++ b/src/qt/forms/sendcoinsdialog.ui @@ -880,7 +880,7 @@ Note: Since the fee is calculated on a per-byte basis, a fee of "100 satoshis p - Paying only the minimum fee is just fine as long as there is less transaction volume than space in the blocks. But be aware that this can end up in a never confirming transaction once there is more demand for bitcoin transactions than the network can process. + Paying only the minimum fee is just fine as long as there is less transaction volume than space in the blocks. But be aware that this can end up in a never confirming transaction once there is more demand for transactions than the network can process. @@ -893,7 +893,7 @@ Note: Since the fee is calculated on a per-byte basis, a fee of "100 satoshis p true - Paying only the minimum fee is just fine as long as there is less transaction volume than space in the blocks. But be aware that this can end up in a never confirming transaction once there is more demand for bitcoin transactions than the network can process. + Paying only the minimum fee is just fine as long as there is less transaction volume than space in the blocks. But be aware that this can end up in a never confirming transaction once there is more demand for transactions than the network can process. (read the tooltip) From 3bedac45a75064f77175f3ce6d1a04bd0e95db79 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 28 Feb 2019 12:22:46 +0000 Subject: [PATCH 74/97] GUI: Drop "(GUI node for Bitcoin)" from program description --- src/qt/res/bitcoin-qt-res.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/res/bitcoin-qt-res.rc b/src/qt/res/bitcoin-qt-res.rc index 0f98506837..d4fb4aca28 100644 --- a/src/qt/res/bitcoin-qt-res.rc +++ b/src/qt/res/bitcoin-qt-res.rc @@ -20,7 +20,7 @@ BEGIN BLOCK "040904E4" // U.S. English - multilingual (hex) BEGIN VALUE "CompanyName", "Bitcoin" - VALUE "FileDescription", PACKAGE_NAME " (GUI node for Bitcoin)" + VALUE "FileDescription", PACKAGE_NAME VALUE "FileVersion", VER_FILEVERSION_STR VALUE "InternalName", "elements-qt" VALUE "LegalCopyright", COPYRIGHT_STR From f96392040c6d98d7a529d55cb6a5a15a2b526eca Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Thu, 28 Feb 2019 12:35:36 +0000 Subject: [PATCH 75/97] GUI: Pre-render amount for transaction notifications so asset is correct --- src/qt/bitcoingui.cpp | 6 +++--- src/qt/bitcoingui.h | 2 +- src/qt/walletview.cpp | 4 ++-- src/qt/walletview.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index c97be1595b..a54a3eaab8 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1008,11 +1008,11 @@ void BitcoinGUI::showEvent(QShowEvent *event) } #ifdef ENABLE_WALLET -void BitcoinGUI::incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label, const QString& walletName) +void BitcoinGUI::incomingTransaction(const QString& date, const QString& assetamount_str, const QString& type, const QString& address, const QString& label, const QString& walletName) { // On new transaction, make an info balloon QString msg = tr("Date: %1\n").arg(date) + - tr("Amount: %1\n").arg(BitcoinUnits::formatWithUnit(unit, amount, true)); + tr("Amount: %1\n").arg(assetamount_str) + if (m_node.getWallets().size() > 1 && !walletName.isEmpty()) { msg += tr("Wallet: %1\n").arg(walletName); } @@ -1021,7 +1021,7 @@ void BitcoinGUI::incomingTransaction(const QString& date, int unit, const CAmoun msg += tr("Label: %1\n").arg(label); else if (!address.isEmpty()) msg += tr("Address: %1\n").arg(address); - message((amount)<0 ? tr("Sent transaction") : tr("Incoming transaction"), + message(assetamount_str.startsWith("-") ? tr("Sent transaction") : tr("Incoming transaction"), msg, CClientUIInterface::MSG_INFORMATION); } #endif // ENABLE_WALLET diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index dcaca10557..dc461173c1 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -221,7 +221,7 @@ public Q_SLOTS: bool handlePaymentRequest(const SendCoinsRecipient& recipient); /** Show incoming transaction notification for new transactions. */ - void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label, const QString& walletName); + void incomingTransaction(const QString& date, const QString& assetamount_str, const QString& type, const QString& address, const QString& label, const QString& walletName); #endif // ENABLE_WALLET private: diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index 0d9ccbf86a..3993c4ea84 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -165,13 +165,13 @@ void WalletView::processNewTransaction(const QModelIndex& parent, int start, int return; QString date = ttm->index(start, TransactionTableModel::Date, parent).data().toString(); - qint64 amount = ttm->index(start, TransactionTableModel::Amount, parent).data(Qt::EditRole).toULongLong(); + QString assetamount_str = ttm->index(start, TransactionTableModel::Amount, parent).data().toString(); QString type = ttm->index(start, TransactionTableModel::Type, parent).data().toString(); QModelIndex index = ttm->index(start, 0, parent); QString address = ttm->data(index, TransactionTableModel::AddressRole).toString(); QString label = ttm->data(index, TransactionTableModel::LabelRole).toString(); - Q_EMIT incomingTransaction(date, walletModel->getOptionsModel()->getDisplayUnit(), amount, type, address, label, walletModel->getWalletName()); + Q_EMIT incomingTransaction(date, walletModel->getOptionsModel()->getDisplayUnit(), assetamount_str, address, label, walletModel->getWalletName()); } void WalletView::gotoOverviewPage() diff --git a/src/qt/walletview.h b/src/qt/walletview.h index e29c4c52f5..4c55efd1e8 100644 --- a/src/qt/walletview.h +++ b/src/qt/walletview.h @@ -124,7 +124,7 @@ public Q_SLOTS: /** HD-Enabled status of wallet changed (only possible during startup) */ void hdEnabledStatusChanged(); /** Notify that a new transaction appeared */ - void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label, const QString& walletName); + void incomingTransaction(const QString& date, const QString& assetamount_str, const QString& type, const QString& address, const QString& label, const QString& walletName); /** Notify that the out of sync warning icon has been pressed */ void outOfSyncWarningClicked(); }; From 3779ae290d930c33ad81c34ee14e68e9be909b7e Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 4 Mar 2019 22:52:20 +0000 Subject: [PATCH 76/97] Bugfix: GUI: Re-enable Show/Remove buttons on Receive tab --- src/qt/receivecoinsdialog.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index 179aa0adbf..01be25dac5 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -94,10 +94,12 @@ void ReceiveCoinsDialog::setModel(WalletModel *_model) #if 0 tableView->setColumnWidth(RecentRequestsTableModel::Label, LABEL_COLUMN_WIDTH); tableView->setColumnWidth(RecentRequestsTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH); +#endif connect(tableView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &ReceiveCoinsDialog::recentRequestsView_selectionChanged); +#if 0 // Last 2 columns are set by the columnResizingFixer, when the table geometry is ready. columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH, this); #endif From 3241af9d404f2e6f731cea2eecd0224a2c80ffc3 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 4 Mar 2019 23:42:14 +0000 Subject: [PATCH 77/97] GUI: Adjust recommended number of blocks confirmed to 2 --- src/qt/transactionrecord.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/transactionrecord.h b/src/qt/transactionrecord.h index 9fdb5b6a65..6661705e51 100644 --- a/src/qt/transactionrecord.h +++ b/src/qt/transactionrecord.h @@ -88,7 +88,7 @@ class TransactionRecord }; /** Number of confirmation recommended for accepting a transaction */ - static const int RecommendedNumConfirmations = 6; + static const int RecommendedNumConfirmations = 2; TransactionRecord(): hash(), time(0), type(Other), address(""), amount(0), idx(0) From 1a654f449b5a31c14455ed6e6d461ec471a45054 Mon Sep 17 00:00:00 2001 From: Riccardo Casatta Date: Wed, 6 Mar 2019 11:12:32 +0100 Subject: [PATCH 78/97] fix logo position and size on retina displays --- src/qt/splashscreen.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index ed8a5fd1b9..bcfb56a321 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -69,7 +69,8 @@ SplashScreen::SplashScreen(interfaces::Node& node, Qt::WindowFlags f, const Netw pixPaint.fillRect(rGradient, gradient); // draw the bitcoin icon, expected size of PNG: 1024x1024 - QRect rectIcon(QPoint(32,-32), QSize(pixmap.size().height()+64,pixmap.size().height()+64)); + int _32 = 32 / devicePixelRatio; + QRect rectIcon(QPoint(_32,-_32/2), QSize(pixmap.size().height()/devicePixelRatio+_32*2,pixmap.size().height()/devicePixelRatio+_32*2)); const QSize requiredSize(1024,1024); QPixmap icon(networkStyle->getAppIcon().pixmap(requiredSize)); From cbf93b9b6b1c1cb0ac505346cde90f13a6ff0aa8 Mon Sep 17 00:00:00 2001 From: Daniel Olaya Date: Fri, 8 Mar 2019 10:45:40 -0800 Subject: [PATCH 79/97] Added liquid.conf template --- share/examples/liquid.conf | 416 +++++++++++++++++++++++++++++++++++++ 1 file changed, 416 insertions(+) create mode 100644 share/examples/liquid.conf diff --git a/share/examples/liquid.conf b/share/examples/liquid.conf new file mode 100644 index 0000000000..703420f745 --- /dev/null +++ b/share/examples/liquid.conf @@ -0,0 +1,416 @@ +### Liquid Core Daemon configuration file example + +# Chain is Liquid +chain=liquidv1 + +# Execute command when a relevant alert is received or we see a really +# long fork (%s in cmd is replaced by message) +# alertnotify= + +# Execute command when the best block changes (%s in cmd is replaced by +# block hash) +# blocknotify= + +# If this block is in the chain assume that it and its ancestors are valid +# and potentially skip their script verification (0 to verify all, +# default: 0000000000000000000000000000000000000000000000000000000000000000) +# assumevalid= + +# Specify configuration file (default: liquid.conf) +# conf= + +# Run in the background as a daemon and accept commands +# daemon=1 + +# Specify data directory +# datadir= + +# Set database cache size in megabytes (4 to 16384, default: 450) +# dbcache=450 + +# Imports blocks from external blk000??.dat file on startup +# loadblock= + +# Keep at most unconnectable transactions in memory (default: 100) +# maxorphantx=100 + +# Keep the transaction memory pool below megabytes (default: 300) +# maxmempool=300 + +# Do not keep transactions in the mempool longer than hours (default: +# 336) +# mempoolexpiry= + +# Extra transactions to keep in memory for compact block reconstructions +# (default: 100) +# blockreconstructionextratxn=100 + +# Set the number of script verification threads (-2 to 16, 0 = auto, <0 = +# leave that many cores free, default: 0) +# par=0 + +# Specify pid file (default: liquidd.pid) +# pid= + +# Reduce storage requirements by enabling pruning (deleting) of old +# blocks. This allows the pruneblockchain RPC to be called to +# delete specific blocks, and enables automatic pruning of old +# blocks if a target size in MiB is provided. This mode is +# incompatible with -txindex and -rescan. Warning: Reverting this +# setting requires re-downloading the entire blockchain. (default: +# 0 = disable pruning blocks, 1 = allow manual pruning via RPC, +# >550 = automatically prune block files to stay under the +# specified target size in MiB) +# prune=0 + +# Rebuild chain state from the currently indexed blocks +# reindex-chainstate + +# Rebuild chain state and block index from the blk*.dat files on disk +# reindex + +# Create new files with system default permissions, instead of umask 077 +# (only effective with disabled wallet functionality) +# sysperms + +# Maintain a full transaction index, used by the getrawtransaction rpc +# call (default: 0) +# txindex=0 + +### Connection options: + +# Add a node to connect to and attempt to keep the connection open +# addnode= + +# Threshold for disconnecting misbehaving peers (default: 100) +# banscore= + +# Number of seconds to keep misbehaving peers from reconnecting (default: +# 86400) +# bantime= + +# Bind to given address and always listen on it. Use [host]:port notation +# for IPv6 +# bind= + +# Connect only to the specified node(s); -noconnect or -connect=0 alone to +# disable automatic connections +# connect= + +# Discover own IP addresses (default: 1 when listening and no -externalip +# or -proxy) +# discover=1 + +# Allow DNS lookups for -addnode, -seednode and -connect (default: 1) +# dns=1 + +# Query for peer addresses via DNS lookup, if low on addresses (default: 1 +# unless -connect/-noconnect) +# dnsseed=1 + +# Specify your own public address +# externalip= + +# Always query for peer addresses via DNS lookup (default: 0) +# forcednsseed=0 + +# Accept connections from outside (default: 1 if no -proxy or +# connect/-noconnect) +# listen=1 + +# Automatically create Tor hidden service (default: 1) +# listenonion=1 + +# Maintain at most connections to peers (default: 125) +# maxconnections=125 + +# Maximum per-connection receive buffer, *1000 bytes (default: 5000) +# maxreceivebuffer=5000 + +# Maximum per-connection send buffer, *1000 bytes (default: 1000) +# maxsendbuffer=1000 + +# Maximum allowed median peer time offset adjustment. Local perspective of +# time may be influenced by peers forward or backward by this +# amount. (default: 4200 seconds) +# maxtimeadjustment=4200 + +# Use separate SOCKS5 proxy to reach peers via Tor hidden services +# (default: -proxy) +# onion= + +# Only connect to nodes in network (ipv4, ipv6 or onion) +# onlynet= + +# Relay non-P2SH multisig (default: 1) +# permitbaremultisig=1 + +# Support filtering of blocks and transaction with bloom filters (default: +#0) +# peerbloomfilters=0 + +# Listen for connections on (default: 7042) +# port=7042 + +# Connect through SOCKS5 proxy +# proxy= + +# Randomize credentials for every proxy connection. This enables Tor +# tream isolation (default: 1) +# proxyrandomize=1 + +# Sets the serialization of raw transaction or block hex returned in +# non-verbose mode, non-segwit(0) or segwit(1) (default: 1) +# rpcserialversion=1 + +# Connect to a node to retrieve peer addresses, and disconnect +# seednode= + +# Specify connection timeout in milliseconds (minimum: 1, default: 5000) +# timeout=5000 + +# Tor control port to use if onion listening enabled (default: +# 127.0.0.1:9051) +# torcontrol=127.0.0.1:9051 + +# Tor control port password (default: empty) +# torpassword= + +# Use UPnP to map the listening port (default: 0) +# upnp=0 + +# Bind to given address and whitelist peers connecting to it. Use +# [host]:port notation for IPv6 +# whitebind= + +# Whitelist peers connecting from the given IP address (e.g. 1.2.3.4) or +# CIDR notated network (e.g. 1.2.3.0/24). Can be specified multiple +# times. Whitelisted peers cannot be DoS banned and their +# transactions are always relayed, even if they are already in the +# mempool, useful e.g. for a gateway +# whitelist= + +# Accept relayed transactions received from whitelisted peers even when +# not relaying transactions (default: 1) +# whitelistrelay=1 + +# Force relay of transactions from whitelisted peers even if they violate +# local relay policy (default: 1) +# whitelistforcerelay=1 + +# Tries to keep outbound traffic under the given target (in MiB per 24h), +# 0 = no limit (default: 0) +# maxuploadtarget=0 + +### Wallet options: + +# Do not load the wallet and disable wallet RPC calls +# disablewallet=0 + +# Set key pool size to (default: 100) +# keypool=100 + +# A fee rate (in BTC/kB) that will be used when fee estimation has +# insufficient data (default: 0.00001) +# fallbackfee=0.00001 + +# Fees (in BTC/kB) smaller than this are considered zero fee for +# transaction creation (default: 0.00001) +# mintxfee=0.00001 + +# Fee (in BTC/kB) to add to transactions you send (default: 0.00) +# paytxfee=0.00 + +# Rescan the block chain for missing wallet transactions on startup +# rescan=0 + +# Attempt to recover private keys from a corrupt wallet on startup +# salvagewallet=0 + +# Spend unconfirmed change when sending transactions (default: 1) +# pendzeroconfchange=0 + +# If paytxfee is not set, include enough fee so transactions begin +# confirmation on average within n blocks (default: 6) +# txconfirmtarget=6 + +# Use hierarchical deterministic key generation (HD) after BIP32. Only has +# effect during wallet creation/first start (default: 1) +# usehd=1 + +# Upgrade wallet to latest format on startup +# upgradewallet=0 + +# Specify wallet file (within data directory) (default: wallet.dat) +# wallet= + +# Make the wallet broadcast transactions (default: 1) +# walletbroadcast=1 + +# Execute command when a wallet transaction changes (%s in cmd is replaced +# by TxID) +# walletnotify= + +# Delete all wallet transactions and only recover those parts of the +# blockchain through -rescan on startup (1 = keep tx meta data e.g. +# account owner and payment request information, 2 = drop tx meta +# data) +# zapwallettxes= + +### ZeroMQ notification options: + +# Enable publish hash block in
+# zmqpubhashblock=
+ +# Enable publish hash transaction in
+# zmqpubhashtx=
+ +# Enable publish raw block in
+# zmqpubrawblock=
+ +# Enable publish raw transaction in
+# zmqpubrawtx=
+ +### Debugging/Testing options: + +# Append comment to the user agent string +# uacomment= + +# Output debugging information (default: 0, supplying is +# optional). If is not supplied or if = 1, +# output all debugging information. can be: addrman, +# alert, bench, cmpctblock, coindb, db, http, libevent, lock, +# mempool, mempoolrej, net, proxy, prune, rand, reindex, rpc, +# electcoins, tor, zmq. +# debug=0 + +### Show all debugging options (usage: --help -help-debug) +# help-debug + +# Include IP addresses in debug output (default: 0) +# logips=0 + +# Prepend debug output with timestamp (default: 1) +# logtimestamps=1 + +# Asset ID (hex) for mempool/relay fees (default: +# f44259d4fe4b055254b512efe86a88f44d3473039fbee77f6b21060b80c91464) +# feeasset= + +# Fees (in BTC/kB) smaller than this are considered zero fee for relaying, +# mining and transaction creation (default: 0.00001) +# minrelaytxfee=0.00001 + +# Maximum total fees (in BTC) to use in a single wallet transaction or raw +# transaction; setting this too low may abort large transactions +# (default: 0.10) +# maxtxfee=0.10 + +# Send trace/debug info to console instead of debug.log file +# printtoconsole=0 + +# Shrink debug.log file on client startup (default: 1 when no -debug) +# hrinkdebugfile=1 + +### Chain selection options: + +# Use the chain (default: liquidregtest). Anything except main is +# allowed +# chain= + +### Node relay options: + +# Equivalent bytes per sigop in transactions for relay and mining +# (default: 20) +# bytespersigop=20 + +### Relay and mine data carrier transactions (default: 1) +# datacarrier=1 + +# Maximum size of data in data carrier transactions we relay and mine +# (default: 83) +# datacarriersize=83 + +### Block creation options: + +# Set maximum BIP141 block weight (default: 4000000) +# blockmaxweight=4000000 + +# Set maximum block size in bytes (default: 1000000) +# blockmaxsize=1000000 + +# Set maximum size of high-priority/low-fee transactions in bytes +# (default: 200000) +# blockprioritysize=200000 + +# Set lowest fee rate (in BTC/kB) for transactions to be included in block +# creation. (default: 0.00001) +# blockmintxfee=0.00001 + +### RPC server options: + +# Accept command line and JSON-RPC commands +# server=1 + +# Accept public REST requests (default: 0) +# rest=0 + +# Bind to given address to listen for JSON-RPC connections. Use +# [host]:port notation for IPv6. This option can be specified +# multiple times (default: bind to all interfaces) +# rpcbind= + +# Location of the auth cookie (default: data dir) +# rpccookiefile= + +# Username for JSON-RPC connections +# rpcuser= + +# Password for JSON-RPC connections +# rpcpassword= + +# Username and hashed password for JSON-RPC connections. The field +# comes in the format: :$. A +# canonical python script is included in share/rpcuser. The client +# then connects normally using the +# rpcuser=/rpcpassword= pair of arguments. This +# option can be specified multiple times +# rpcauth= + +# Listen for JSON-RPC connections on (default: 8332) +# rpcport=8332 + +# Allow JSON-RPC connections from specified source. Valid for are a +# single IP (e.g. 1.2.3.4), a network/netmask (e.g. +# 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This +# option can be specified multiple times +# rpcallowip= + +# Set the number of threads to service RPC calls (default: 4) +# rpcthreads=4 + +### Federated peg options: + +# Validate pegin claims. All functionaries must run this. (default: 1) +# validatepegin=1 + +# The address which the daemon will try to connect to validate peg-ins, if +# enabled. (default: cookie auth) +# mainchainrpchost= + +# The port which the daemon will try to connect to validate peg-ins, if +# enabled. (default: cookie auth) +# mainchainrpcport= + +# The rpc username that the daemon will use to connect to validate +# peg-ins, if enabled. (default: cookie auth) +# mainchainrpcuser= + +# The rpc password which the daemon will use to connect to validate +# peg-ins, if enabled. (default: cookie auth) +# mainchainrpcpassword= + +# The bitcoind cookie auth path which the daemon will use to connect to +# validate peg-ins, if enabled. (default: default bitcoind datadir) +# mainchainrpccookiefile= + From 0aff67508a9dc6c9a70c4fd94a10766acf624990 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 10 Apr 2019 11:07:26 -0400 Subject: [PATCH 80/97] f'GUI: Add liquidv1 network style' --- src/qt/networkstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/networkstyle.cpp b/src/qt/networkstyle.cpp index 8b9624b3c8..faef4bce48 100644 --- a/src/qt/networkstyle.cpp +++ b/src/qt/networkstyle.cpp @@ -19,7 +19,7 @@ static const struct { } network_styles[] = { {"main", QAPP_APP_NAME_DEFAULT, 0, 0}, {"test", QAPP_APP_NAME_TESTNET, 70, 30}, - {CHAINPARAMS_LIQUIDV1, "Liquid-Qt-liquidv1", 0, 0}, + {"liquidv1", "Liquid-Qt-liquidv1", 0, 0}, {"regtest", QAPP_APP_NAME_TESTNET, 160, 30} }; static const unsigned network_styles_count = sizeof(network_styles)/sizeof(*network_styles); From 084a2fdc95e173580f9bd6f00e59be9be65453c8 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 10 Apr 2019 11:09:20 -0400 Subject: [PATCH 81/97] f'GUI: Make liquidv1 the' --- src/qt/networkstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/networkstyle.cpp b/src/qt/networkstyle.cpp index faef4bce48..45c67900db 100644 --- a/src/qt/networkstyle.cpp +++ b/src/qt/networkstyle.cpp @@ -80,7 +80,7 @@ NetworkStyle::NetworkStyle(const QString &_appName, const int iconColorHueShift, const NetworkStyle* NetworkStyle::instantiate(const std::string& networkId) { - std::string titleAddText = networkId == CBaseChainParams::LIQUIDV1 ? "" : strprintf("[%s]", networkId); + std::string titleAddText = networkId == "liquidv1" ? "" : strprintf("[%s]", networkId); for (unsigned x=0; x Date: Wed, 10 Apr 2019 11:12:14 -0400 Subject: [PATCH 82/97] f'GUI: Disable Subtract fee from amount' --- src/qt/sendcoinsentry.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index ca0c886c5c..f3ed74d1ac 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -15,6 +15,7 @@ #include #include +#include SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *parent) : QStackedWidget(parent), From d51b9edcd44155eb59f457dc5ecb97147c0c9d9f Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 10 Apr 2019 11:14:38 -0400 Subject: [PATCH 83/97] f'GUI: Display label rather than address on popups' --- src/qt/bitcoingui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index a54a3eaab8..fc7761af7d 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1012,7 +1012,7 @@ void BitcoinGUI::incomingTransaction(const QString& date, const QString& assetam { // On new transaction, make an info balloon QString msg = tr("Date: %1\n").arg(date) + - tr("Amount: %1\n").arg(assetamount_str) + + tr("Amount: %1\n").arg(assetamount_str); if (m_node.getWallets().size() > 1 && !walletName.isEmpty()) { msg += tr("Wallet: %1\n").arg(walletName); } From acf243683efbbcce47068f06620608b7a1c2e402 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 10 Apr 2019 11:22:44 -0400 Subject: [PATCH 84/97] f'GUI: Pre-render amount for transaction notifications so asset is correct' --- src/qt/walletview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index 3993c4ea84..afce24339c 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -171,7 +171,7 @@ void WalletView::processNewTransaction(const QModelIndex& parent, int start, int QString address = ttm->data(index, TransactionTableModel::AddressRole).toString(); QString label = ttm->data(index, TransactionTableModel::LabelRole).toString(); - Q_EMIT incomingTransaction(date, walletModel->getOptionsModel()->getDisplayUnit(), assetamount_str, address, label, walletModel->getWalletName()); + Q_EMIT incomingTransaction(date, assetamount_str, type, address, label, walletModel->getWalletName()); } void WalletView::gotoOverviewPage() From 967ed8385211cb2e1aba7c6e00994290424b531a Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 10 Apr 2019 11:25:25 -0400 Subject: [PATCH 85/97] f'init: If bitcoind is unreachable, explain where the user can get it' --- src/init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/init.cpp b/src/init.cpp index 991502320a..fd0d02af64 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1873,7 +1873,7 @@ bool AppInitMain() } uiInterface.InitMessage(_("Awaiting mainchain RPC warmup")); if (!MainchainRPCCheck(true)) { //Initial check, fail immediately - return InitError(_("ERROR: elementsd is set to verify pegins but cannot get valid response from the mainchain daemon. Please check debug.log for more information.")); + return InitError(_("ERROR: elementsd is set to verify pegins but cannot get valid response from the mainchain daemon. Please check debug.log for more information.") + "\n\n" + strprintf(_("If you haven't setup a %s please get the latest stable version from %s or if you do not need to validate pegins set in your elements configuration %s"), "bitcoind", "https://bitcoincore.org/en/download/", "validatepegin=0")); } From 7108ab76e3ce65cf065868bc3277adc8c01756cc Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 10 Apr 2019 12:01:04 -0400 Subject: [PATCH 86/97] Add unix build notes for Elements-QT dependencies --- doc/build-unix.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/build-unix.md b/doc/build-unix.md index bd25d86349..aca07199ca 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -105,7 +105,9 @@ To build without GUI pass `--without-gui`. To build with Qt 5 you need the following: - sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler + sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler imagemagick librsvg2-bin + +The last two dependencies are required to generate Elements images that don't exist in Bitcoin Core. libqrencode (optional) can be installed with: From 1dde8a7ff5fcc315d105f22922a58ecc8e612beb Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 10 Apr 2019 12:07:49 -0400 Subject: [PATCH 87/97] Update blech32 checkbox text --- src/qt/forms/receivecoinsdialog.ui | 2 +- src/qt/locale/bitcoin_ca.ts | 2 +- src/qt/locale/bitcoin_da.ts | 2 +- src/qt/locale/bitcoin_de.ts | 2 +- src/qt/locale/bitcoin_en.ts | 2 +- src/qt/locale/bitcoin_es.ts | 2 +- src/qt/locale/bitcoin_fr.ts | 2 +- src/qt/locale/bitcoin_he.ts | 2 +- src/qt/locale/bitcoin_hu.ts | 2 +- src/qt/locale/bitcoin_it.ts | 2 +- src/qt/locale/bitcoin_ja.ts | 2 +- src/qt/locale/bitcoin_ko_KR.ts | 2 +- src/qt/locale/bitcoin_nl.ts | 2 +- src/qt/locale/bitcoin_pl.ts | 2 +- src/qt/locale/bitcoin_pt_BR.ts | 2 +- src/qt/locale/bitcoin_pt_PT.ts | 2 +- src/qt/locale/bitcoin_ro_RO.ts | 2 +- src/qt/locale/bitcoin_sk.ts | 2 +- src/qt/locale/bitcoin_uk.ts | 2 +- src/qt/locale/bitcoin_zh_CN.ts | 2 +- src/qt/locale/bitcoin_zh_TW.ts | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/qt/forms/receivecoinsdialog.ui b/src/qt/forms/receivecoinsdialog.ui index 2f916d0b44..066b932fc5 100644 --- a/src/qt/forms/receivecoinsdialog.ui +++ b/src/qt/forms/receivecoinsdialog.ui @@ -209,7 +209,7 @@ Native segwit addresses (aka Bech32 or BIP-173) reduce your transaction fees later on and offer better protection against typos, but old wallets don't support them. When unchecked, an address compatible with older wallets will be created instead. - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address diff --git a/src/qt/locale/bitcoin_ca.ts b/src/qt/locale/bitcoin_ca.ts index 2926736498..a767a515ef 100644 --- a/src/qt/locale/bitcoin_ca.ts +++ b/src/qt/locale/bitcoin_ca.ts @@ -1926,7 +1926,7 @@ Les adreces segwit natives (més conegudes com Bech32 o BIP-173) redueixen les vostres comisions de les transaccions i ofereixen millor protecció contra errades tipogràfiques, però els moneders antics no les suporten. Quan desmarqui la casella, es generarà una adreça compatible amb moneders antics. - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address Generar una adreça segwit nativa (Bech32) diff --git a/src/qt/locale/bitcoin_da.ts b/src/qt/locale/bitcoin_da.ts index c7a2422c8a..93fdfa8b56 100644 --- a/src/qt/locale/bitcoin_da.ts +++ b/src/qt/locale/bitcoin_da.ts @@ -1926,7 +1926,7 @@ Rene segwit-adresser (kendt som Bech32 eller BIP-173) reducerer dine transaktionsgebyrer i det lange løb og giver bedre beskyttelse imod tastefejl, men gamle tegnebøger understøtter dem ikke. Hvis dette ikke vælges, vil i stedet en adresse, der fungerer med ældre tegnebøger, oprettes. - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address Generér rene segwit-adresser (Bech32) diff --git a/src/qt/locale/bitcoin_de.ts b/src/qt/locale/bitcoin_de.ts index 06c1a54d40..e7a1a139c5 100644 --- a/src/qt/locale/bitcoin_de.ts +++ b/src/qt/locale/bitcoin_de.ts @@ -1922,7 +1922,7 @@ Ureigene SegWit-Adressen (alias Bech32 oder BIP-173) werden Ihre Transaktionsgebühren senken und bieten besseren Tippfehlerschutz, werden jedoch von alten Brieftaschen nicht unterstützt. Wenn abgewählt, wird eine mit älteren Brieftaschen kompatible Adresse erstellt. - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address Generiere ureigene SegWit(Bech32)-Adresse diff --git a/src/qt/locale/bitcoin_en.ts b/src/qt/locale/bitcoin_en.ts index fbff2d36a0..2a081391fd 100644 --- a/src/qt/locale/bitcoin_en.ts +++ b/src/qt/locale/bitcoin_en.ts @@ -2496,7 +2496,7 @@ - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address diff --git a/src/qt/locale/bitcoin_es.ts b/src/qt/locale/bitcoin_es.ts index f55a7ce9c4..8e2187244b 100644 --- a/src/qt/locale/bitcoin_es.ts +++ b/src/qt/locale/bitcoin_es.ts @@ -1925,7 +1925,7 @@ Las direcciones segwit nativas (también conocidas como Bech32 o BIP-173) reducen las comisiones de transacción más adelante y ofrecen una mejor protección contra errores tipográficos, pero las billeteras antiguas no las admiten. Cuando no está marcada, se creará una dirección compatible con billeteras más antiguas. - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address Generar dirección segwit nativa (Bech32) diff --git a/src/qt/locale/bitcoin_fr.ts b/src/qt/locale/bitcoin_fr.ts index 5faba54d5b..bbdee53624 100644 --- a/src/qt/locale/bitcoin_fr.ts +++ b/src/qt/locale/bitcoin_fr.ts @@ -1926,7 +1926,7 @@ Les adresses SegWit natives (aussi appelées Bech32 ou BIP-173) réduisent vos frais de transaction ultérieurs et offrent une meilleure protection contre les erreurs de frappe, mais les anciens porte-monnaie ne les prennent pas en charge. Si cette option n’est pas cochée, une adresse compatible avec les anciens porte-monnaie sera plutôt créée. - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address Générer une adresse SegWit native (Bech32) diff --git a/src/qt/locale/bitcoin_he.ts b/src/qt/locale/bitcoin_he.ts index cf884f0fc7..61d5e120be 100644 --- a/src/qt/locale/bitcoin_he.ts +++ b/src/qt/locale/bitcoin_he.ts @@ -1890,7 +1890,7 @@ כתובות segwit טבעיות (כלומר Bech32 או BIP-173) מפחיתות את עמלת העסקה שלכם בהמשך ומציעות הגנה נגד שגיאות כתיב, אך ארנקים ישנים לא תומכים בהן. אם לא סומן, כתובת תאימה לארנקים ישנים תיווצר במקום. - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address הפקת כתובת segwit טבעית (Bech32) diff --git a/src/qt/locale/bitcoin_hu.ts b/src/qt/locale/bitcoin_hu.ts index 3a3990c265..29b7669d3e 100644 --- a/src/qt/locale/bitcoin_hu.ts +++ b/src/qt/locale/bitcoin_hu.ts @@ -1817,7 +1817,7 @@ Kérem a kulcsmondatban használjon <b> tíz vagy több véletlenszerű ka Segwit címek (Bech32 vagy BIP-173) csökkentik a tranzakciók díját és jobb védelmet biztosítanak gépelési hibával szemben, de a régi pénztárcák nem támogatják. Ha nincs aktiválva, egy régi pénztárcával is kompatibilis cím lesz létrehozva. - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address Segwit cím (Bech32) létrehozása diff --git a/src/qt/locale/bitcoin_it.ts b/src/qt/locale/bitcoin_it.ts index 5b24fcdf46..f0443ac4ef 100644 --- a/src/qt/locale/bitcoin_it.ts +++ b/src/qt/locale/bitcoin_it.ts @@ -1907,7 +1907,7 @@ Per specificare più URL separarli con una barra verticale "|". Gli indirizzi nativi segwit (noti anche come Bech32 o BIP-173) riducono le spese di transazione e offrono una migliore protezione dagli errori di battitura, ma i vecchi portafogli non li supportano. Se deselezionata, verrà creato un indirizzo compatibile con i portafogli meno recenti. - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address Genera indirizzo nativo segwit (Bech32) diff --git a/src/qt/locale/bitcoin_ja.ts b/src/qt/locale/bitcoin_ja.ts index 284bdb39b5..df47c4583d 100644 --- a/src/qt/locale/bitcoin_ja.ts +++ b/src/qt/locale/bitcoin_ja.ts @@ -1926,7 +1926,7 @@ Segwitアドレス(Bech32もしくはBIP-173アドレス)を利用すると手数料が安くなり、また誤入力防止機能も強化されますが、Segwitアドレスをサポートしない古いウォレットとの互換性は失われます。チェックを外すと、古いウォレットとの互換性を保った古いアドレスが代わりに生成されます。 - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address Segwitアドレス(Bech32アドレス)を生成する diff --git a/src/qt/locale/bitcoin_ko_KR.ts b/src/qt/locale/bitcoin_ko_KR.ts index 9912cc76e2..8683964989 100644 --- a/src/qt/locale/bitcoin_ko_KR.ts +++ b/src/qt/locale/bitcoin_ko_KR.ts @@ -1926,7 +1926,7 @@ Bech32 주소 (BIP-173)는 더 적은 수수료와 오입금으로부터 방지해 줍니다. Bech32가 비활성화 되어있으면 P2SH 기반의 세그윗 주소가 대신 생성됩니다. - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address Bech32 세그윗 주소 생성 diff --git a/src/qt/locale/bitcoin_nl.ts b/src/qt/locale/bitcoin_nl.ts index 747a62510f..ad59def395 100644 --- a/src/qt/locale/bitcoin_nl.ts +++ b/src/qt/locale/bitcoin_nl.ts @@ -1926,7 +1926,7 @@ Native segwit-adressen (Bech32 of BIP-173) reduceren later je transactiekosten en bieden een betere bescherming tegen typefouten, maar oude portemonnees ondersteunen deze niet. Een adres dat is compatibel met oudere portemonnees zal worden gecreëerd indien dit niet is aangevinkt. - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address Genereer native segwit-adres (Bech32) diff --git a/src/qt/locale/bitcoin_pl.ts b/src/qt/locale/bitcoin_pl.ts index a1437b8808..3b4a254a63 100644 --- a/src/qt/locale/bitcoin_pl.ts +++ b/src/qt/locale/bitcoin_pl.ts @@ -1926,7 +1926,7 @@ Natywne adresy segwit (aka Bech32 lub BIP-173) zmniejszają później twoje opłaty transakcyjne i dają lepsze zabezpieczenie przed literówkami, ale stare portfele ich nie obsługują. Jeżeli odznaczone, stworzony zostanie adres kompatybilny ze starszymi portfelami. - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address Wygeneruj natywny adres segwit (Bech32) diff --git a/src/qt/locale/bitcoin_pt_BR.ts b/src/qt/locale/bitcoin_pt_BR.ts index e964838d9f..8336f33e22 100644 --- a/src/qt/locale/bitcoin_pt_BR.ts +++ b/src/qt/locale/bitcoin_pt_BR.ts @@ -1922,7 +1922,7 @@ Endereços segwit nativos (também conhecidos como Bench32 ou BIP-173) reduzem suas taxas de transação mais adiante e oferecem melhor proteção contra erros de digitação, porém carteiras antigas não têm suporte a eles. Quando não estiver rubricado, um endereço compatível com cateiras antigas será criado como alternativa. - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address Gere um endereço segwit (Bench32) nativo diff --git a/src/qt/locale/bitcoin_pt_PT.ts b/src/qt/locale/bitcoin_pt_PT.ts index 48068409be..5677c8075e 100644 --- a/src/qt/locale/bitcoin_pt_PT.ts +++ b/src/qt/locale/bitcoin_pt_PT.ts @@ -1899,7 +1899,7 @@ Endereços nativos SegWit (também conhecidos como Bech32 ou BIP-173) reduzem as taxas da sua transação mais tarde e oferecem melhor protecção contra erros, mas carteiras antigas não os suportam. Quando não selecionado, um endereço compatível com carteiras antigas irá ser criado em vez. - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address Gerar endereço nativo SegWit (Bech32) diff --git a/src/qt/locale/bitcoin_ro_RO.ts b/src/qt/locale/bitcoin_ro_RO.ts index 503c15259b..287b079202 100644 --- a/src/qt/locale/bitcoin_ro_RO.ts +++ b/src/qt/locale/bitcoin_ro_RO.ts @@ -1878,7 +1878,7 @@ Adresele native segwit (aka Bech32 sau BIP-173) vor reduce mai tarziu comisioanele de tranzactionare si vor oferi o mai buna protectie impotriva introducerii gresite, dar portofelele vechi nu sunt compatibile. Daca optiunea nu e bifata, se va crea o adresa compatibila cu portofelele vechi. - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address Genereaza adresa nativa segwit (Bech32) diff --git a/src/qt/locale/bitcoin_sk.ts b/src/qt/locale/bitcoin_sk.ts index 6a69bfe63c..5d68a8d4c2 100644 --- a/src/qt/locale/bitcoin_sk.ts +++ b/src/qt/locale/bitcoin_sk.ts @@ -1891,7 +1891,7 @@ Natívne segwit adresy (Bech32 or BIP-173) znižujú Vaše budúce transakčné poplatky and ponúkajú lepšiu ochranu pred preklepmi, avšak staré peňaženky ich nepodporujú. Ak je toto pole nezaškrtnuté, bude vytvorená adresa kompatibilná so staršími peňaženkami. - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address Generovať natívnu segwit adresu (Bech32) diff --git a/src/qt/locale/bitcoin_uk.ts b/src/qt/locale/bitcoin_uk.ts index 1865a84834..8eef258772 100644 --- a/src/qt/locale/bitcoin_uk.ts +++ b/src/qt/locale/bitcoin_uk.ts @@ -1912,7 +1912,7 @@ Чиста сегвіт адреса (segwit, Bech32, BIP-173) знижує комісію та пропонує кращий захист від помилок, але старі гаманці її не підтримують. Якщо позначка знята, буде створено адресу, сумісну зі старими гаманцями. - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address Згенерувати чисту SegWit (Bech32) адресу diff --git a/src/qt/locale/bitcoin_zh_CN.ts b/src/qt/locale/bitcoin_zh_CN.ts index 6678641ad3..8929ae3f42 100644 --- a/src/qt/locale/bitcoin_zh_CN.ts +++ b/src/qt/locale/bitcoin_zh_CN.ts @@ -1797,7 +1797,7 @@ 清除 - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address 生成本地分离见证 (Bech32)地址 diff --git a/src/qt/locale/bitcoin_zh_TW.ts b/src/qt/locale/bitcoin_zh_TW.ts index 0aa7964e39..75225bd604 100644 --- a/src/qt/locale/bitcoin_zh_TW.ts +++ b/src/qt/locale/bitcoin_zh_TW.ts @@ -1926,7 +1926,7 @@ 使用 segwit 原生位址(也叫做 Bech32 或 BIP-173)可以減少日後的交易手續費,也比較不容易打錯字,不過會跟舊版的錢包軟體不相容。如果沒有勾選的話,會改產生與舊版錢包軟體相容的位址。 - Generate native segwit (Bech32) address + Generate blinded native segwit (Blech32) address 產生 segwit 原生位址(Bech32) From dbac2afd0fc8c0e0705b67c48365de326c9db204 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 10 Apr 2019 12:11:36 -0400 Subject: [PATCH 88/97] QT: Enter a s/Bitcoin/Liquid/ address --- src/qt/guiutil.cpp | 2 +- src/qt/locale/bitcoin_af.ts | 2 +- src/qt/locale/bitcoin_ar.ts | 2 +- src/qt/locale/bitcoin_bg.ts | 2 +- src/qt/locale/bitcoin_ca.ts | 2 +- src/qt/locale/bitcoin_ca@valencia.ts | 2 +- src/qt/locale/bitcoin_ca_ES.ts | 2 +- src/qt/locale/bitcoin_cs.ts | 2 +- src/qt/locale/bitcoin_da.ts | 2 +- src/qt/locale/bitcoin_de.ts | 2 +- src/qt/locale/bitcoin_el_GR.ts | 2 +- src/qt/locale/bitcoin_en.ts | 2 +- src/qt/locale/bitcoin_en_GB.ts | 4 ++-- src/qt/locale/bitcoin_es.ts | 2 +- src/qt/locale/bitcoin_es_CL.ts | 2 +- src/qt/locale/bitcoin_es_ES.ts | 2 +- src/qt/locale/bitcoin_fa.ts | 2 +- src/qt/locale/bitcoin_fi.ts | 2 +- src/qt/locale/bitcoin_fr.ts | 2 +- src/qt/locale/bitcoin_fr_FR.ts | 2 +- src/qt/locale/bitcoin_he.ts | 2 +- src/qt/locale/bitcoin_hu.ts | 2 +- src/qt/locale/bitcoin_id_ID.ts | 2 +- src/qt/locale/bitcoin_it.ts | 2 +- src/qt/locale/bitcoin_ja.ts | 2 +- src/qt/locale/bitcoin_ko_KR.ts | 2 +- src/qt/locale/bitcoin_nb.ts | 2 +- src/qt/locale/bitcoin_ne.ts | 2 +- src/qt/locale/bitcoin_nl.ts | 2 +- src/qt/locale/bitcoin_pl.ts | 2 +- src/qt/locale/bitcoin_pt_BR.ts | 2 +- src/qt/locale/bitcoin_pt_PT.ts | 2 +- src/qt/locale/bitcoin_ro_RO.ts | 2 +- src/qt/locale/bitcoin_ru_RU.ts | 2 +- src/qt/locale/bitcoin_sk.ts | 2 +- src/qt/locale/bitcoin_sl_SI.ts | 2 +- src/qt/locale/bitcoin_sv.ts | 2 +- src/qt/locale/bitcoin_tr.ts | 2 +- src/qt/locale/bitcoin_tr_TR.ts | 2 +- src/qt/locale/bitcoin_uk.ts | 2 +- src/qt/locale/bitcoin_uz@Cyrl.ts | 2 +- src/qt/locale/bitcoin_vi.ts | 2 +- src/qt/locale/bitcoin_zh_CN.ts | 2 +- src/qt/locale/bitcoin_zh_HK.ts | 2 +- src/qt/locale/bitcoin_zh_TW.ts | 2 +- 45 files changed, 46 insertions(+), 46 deletions(-) diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 27f714de7f..03ef2ac485 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -114,7 +114,7 @@ void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent) widget->setFont(fixedPitchFont()); // We don't want translators to use own addresses in translations // and this is the only place, where this address is supplied. - widget->setPlaceholderText(QObject::tr("Enter a Bitcoin address (e.g. %1)").arg( + widget->setPlaceholderText(QObject::tr("Enter a Liquid address (e.g. %1)").arg( QString::fromStdString(DummyAddress(Params())))); widget->setValidator(new BitcoinAddressEntryValidator(parent)); widget->setCheckValidator(new BitcoinAddressCheckValidator(parent)); diff --git a/src/qt/locale/bitcoin_af.ts b/src/qt/locale/bitcoin_af.ts index bff2db1d6a..ff5f311da2 100644 --- a/src/qt/locale/bitcoin_af.ts +++ b/src/qt/locale/bitcoin_af.ts @@ -1144,7 +1144,7 @@ Bedrag - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Voer in 'n Bitcoin adres (bv. %1) diff --git a/src/qt/locale/bitcoin_ar.ts b/src/qt/locale/bitcoin_ar.ts index 481e02c60e..6571c4e0fd 100644 --- a/src/qt/locale/bitcoin_ar.ts +++ b/src/qt/locale/bitcoin_ar.ts @@ -1350,7 +1350,7 @@ مبلغ - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) ادخل عنوان محفطة البتكوين (مثال %1) diff --git a/src/qt/locale/bitcoin_bg.ts b/src/qt/locale/bitcoin_bg.ts index be7fed59a1..fb098da63c 100644 --- a/src/qt/locale/bitcoin_bg.ts +++ b/src/qt/locale/bitcoin_bg.ts @@ -1136,7 +1136,7 @@ Сума - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Въведете Биткойн адрес (например: %1) diff --git a/src/qt/locale/bitcoin_ca.ts b/src/qt/locale/bitcoin_ca.ts index a767a515ef..ba918349f1 100644 --- a/src/qt/locale/bitcoin_ca.ts +++ b/src/qt/locale/bitcoin_ca.ts @@ -1450,7 +1450,7 @@ Import - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Introduïu una adreça de Bitcoin (p. ex. %1) diff --git a/src/qt/locale/bitcoin_ca@valencia.ts b/src/qt/locale/bitcoin_ca@valencia.ts index b5e65bc4bf..a80149abef 100644 --- a/src/qt/locale/bitcoin_ca@valencia.ts +++ b/src/qt/locale/bitcoin_ca@valencia.ts @@ -1148,7 +1148,7 @@ Import - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Introduïu una adreça de Bitcoin (p. ex. %1) diff --git a/src/qt/locale/bitcoin_ca_ES.ts b/src/qt/locale/bitcoin_ca_ES.ts index 03c5dd853e..0b8054bd23 100644 --- a/src/qt/locale/bitcoin_ca_ES.ts +++ b/src/qt/locale/bitcoin_ca_ES.ts @@ -1304,7 +1304,7 @@ Import - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Introduïu una adreça de Bitcoin (p. ex. %1) diff --git a/src/qt/locale/bitcoin_cs.ts b/src/qt/locale/bitcoin_cs.ts index 260d79b766..a470917fb9 100644 --- a/src/qt/locale/bitcoin_cs.ts +++ b/src/qt/locale/bitcoin_cs.ts @@ -1416,7 +1416,7 @@ Částka - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Zadej bitcoinovou adresu (např. %1) diff --git a/src/qt/locale/bitcoin_da.ts b/src/qt/locale/bitcoin_da.ts index 93fdfa8b56..49125eaa6a 100644 --- a/src/qt/locale/bitcoin_da.ts +++ b/src/qt/locale/bitcoin_da.ts @@ -1450,7 +1450,7 @@ Beløb - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Indtast en Bitcoin-adresse (fx %1) diff --git a/src/qt/locale/bitcoin_de.ts b/src/qt/locale/bitcoin_de.ts index e7a1a139c5..70985043b4 100644 --- a/src/qt/locale/bitcoin_de.ts +++ b/src/qt/locale/bitcoin_de.ts @@ -1446,7 +1446,7 @@ Betrag - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Bitcoin-Adresse eingeben (z.B. %1) diff --git a/src/qt/locale/bitcoin_el_GR.ts b/src/qt/locale/bitcoin_el_GR.ts index ef4ac2d4aa..0df3d78f04 100644 --- a/src/qt/locale/bitcoin_el_GR.ts +++ b/src/qt/locale/bitcoin_el_GR.ts @@ -1096,7 +1096,7 @@ Ποσό - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Εισάγετε μια διεύθυνση Bitcoin (π.χ. %1) diff --git a/src/qt/locale/bitcoin_en.ts b/src/qt/locale/bitcoin_en.ts index 2a081391fd..b16222dbf9 100644 --- a/src/qt/locale/bitcoin_en.ts +++ b/src/qt/locale/bitcoin_en.ts @@ -1843,7 +1843,7 @@ - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) diff --git a/src/qt/locale/bitcoin_en_GB.ts b/src/qt/locale/bitcoin_en_GB.ts index 7da223f52e..eb79abd7e4 100644 --- a/src/qt/locale/bitcoin_en_GB.ts +++ b/src/qt/locale/bitcoin_en_GB.ts @@ -1418,8 +1418,8 @@ Amount - Enter a Bitcoin address (e.g. %1) - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) + Enter a Liquid address (e.g. %1) %1 d diff --git a/src/qt/locale/bitcoin_es.ts b/src/qt/locale/bitcoin_es.ts index 8e2187244b..0c6506f9ac 100644 --- a/src/qt/locale/bitcoin_es.ts +++ b/src/qt/locale/bitcoin_es.ts @@ -1449,7 +1449,7 @@ Cantidad - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Introducir una dirección Bitcoin (p. ej. %1) diff --git a/src/qt/locale/bitcoin_es_CL.ts b/src/qt/locale/bitcoin_es_CL.ts index f8b13e398f..3a26d5fde2 100644 --- a/src/qt/locale/bitcoin_es_CL.ts +++ b/src/qt/locale/bitcoin_es_CL.ts @@ -1330,7 +1330,7 @@ Cantidad - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Ingresa una dirección de Bitcoin (Ejemplo: %1) diff --git a/src/qt/locale/bitcoin_es_ES.ts b/src/qt/locale/bitcoin_es_ES.ts index 1b196cb13f..00dadf2be8 100644 --- a/src/qt/locale/bitcoin_es_ES.ts +++ b/src/qt/locale/bitcoin_es_ES.ts @@ -1324,7 +1324,7 @@ Cantidad - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Introducir una dirección Bitcoin (p. ej. %1) diff --git a/src/qt/locale/bitcoin_fa.ts b/src/qt/locale/bitcoin_fa.ts index 1fa0d9fb44..6594dc0b87 100644 --- a/src/qt/locale/bitcoin_fa.ts +++ b/src/qt/locale/bitcoin_fa.ts @@ -1012,7 +1012,7 @@ مبلغ - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) یک آدرس بیت‌کوین وارد کنید (مثلاً %1) diff --git a/src/qt/locale/bitcoin_fi.ts b/src/qt/locale/bitcoin_fi.ts index 8df4871025..b11d2758b4 100644 --- a/src/qt/locale/bitcoin_fi.ts +++ b/src/qt/locale/bitcoin_fi.ts @@ -1404,7 +1404,7 @@ Määrä - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Syötä Bitcoin-osoite (esim. %1) diff --git a/src/qt/locale/bitcoin_fr.ts b/src/qt/locale/bitcoin_fr.ts index bbdee53624..aeaf0c31e9 100644 --- a/src/qt/locale/bitcoin_fr.ts +++ b/src/qt/locale/bitcoin_fr.ts @@ -1450,7 +1450,7 @@ Montant - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Saisir une adresse Bitcoin (p. ex. %1) diff --git a/src/qt/locale/bitcoin_fr_FR.ts b/src/qt/locale/bitcoin_fr_FR.ts index 10582127c4..610421da31 100644 --- a/src/qt/locale/bitcoin_fr_FR.ts +++ b/src/qt/locale/bitcoin_fr_FR.ts @@ -1112,7 +1112,7 @@ Montant - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Entrer une adresse Bitcoin (e.g. %1) diff --git a/src/qt/locale/bitcoin_he.ts b/src/qt/locale/bitcoin_he.ts index 61d5e120be..ae57bae72b 100644 --- a/src/qt/locale/bitcoin_he.ts +++ b/src/qt/locale/bitcoin_he.ts @@ -1426,7 +1426,7 @@ כמות - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) נא להזין כתובת ביטקוין (למשל: %1) diff --git a/src/qt/locale/bitcoin_hu.ts b/src/qt/locale/bitcoin_hu.ts index 29b7669d3e..60ebc60d69 100644 --- a/src/qt/locale/bitcoin_hu.ts +++ b/src/qt/locale/bitcoin_hu.ts @@ -1377,7 +1377,7 @@ Kérem a kulcsmondatban használjon <b> tíz vagy több véletlenszerű ka Összeg - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Ad meg egy Bitcoin címet (pl: %1) diff --git a/src/qt/locale/bitcoin_id_ID.ts b/src/qt/locale/bitcoin_id_ID.ts index 3c79d54e94..98daafc0ad 100644 --- a/src/qt/locale/bitcoin_id_ID.ts +++ b/src/qt/locale/bitcoin_id_ID.ts @@ -1212,7 +1212,7 @@ Nilai - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Masukkan alamat Bitcoin (contoh %1) diff --git a/src/qt/locale/bitcoin_it.ts b/src/qt/locale/bitcoin_it.ts index f0443ac4ef..734f120c68 100644 --- a/src/qt/locale/bitcoin_it.ts +++ b/src/qt/locale/bitcoin_it.ts @@ -1443,7 +1443,7 @@ Per specificare più URL separarli con una barra verticale "|". Importo - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Inserisci un indirizzo Bitcoin (ad es. %1) diff --git a/src/qt/locale/bitcoin_ja.ts b/src/qt/locale/bitcoin_ja.ts index df47c4583d..16c9062e0f 100644 --- a/src/qt/locale/bitcoin_ja.ts +++ b/src/qt/locale/bitcoin_ja.ts @@ -1450,7 +1450,7 @@ 総額 - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Bitcoinアドレスを入力してください (例 %1) diff --git a/src/qt/locale/bitcoin_ko_KR.ts b/src/qt/locale/bitcoin_ko_KR.ts index 8683964989..41be7cb22b 100644 --- a/src/qt/locale/bitcoin_ko_KR.ts +++ b/src/qt/locale/bitcoin_ko_KR.ts @@ -1450,7 +1450,7 @@ 거래액 - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) 비트코인 주소를 입력하기 (예. %1) diff --git a/src/qt/locale/bitcoin_nb.ts b/src/qt/locale/bitcoin_nb.ts index 89c8e4174b..73adc5342d 100644 --- a/src/qt/locale/bitcoin_nb.ts +++ b/src/qt/locale/bitcoin_nb.ts @@ -1404,7 +1404,7 @@ Beløp - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Oppgi en Bitcoin-adresse (f.eks. %1) diff --git a/src/qt/locale/bitcoin_ne.ts b/src/qt/locale/bitcoin_ne.ts index 4da7d64cee..aaf5ac5829 100644 --- a/src/qt/locale/bitcoin_ne.ts +++ b/src/qt/locale/bitcoin_ne.ts @@ -308,7 +308,7 @@ रकम - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) कृपया बिटकोइन ठेगाना प्रवेश गर्नुहोस् (उदाहरण %1) diff --git a/src/qt/locale/bitcoin_nl.ts b/src/qt/locale/bitcoin_nl.ts index ad59def395..b731103544 100644 --- a/src/qt/locale/bitcoin_nl.ts +++ b/src/qt/locale/bitcoin_nl.ts @@ -1450,7 +1450,7 @@ Bedrag - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Voer een Bitcoinadres in (bijv. %1) diff --git a/src/qt/locale/bitcoin_pl.ts b/src/qt/locale/bitcoin_pl.ts index 3b4a254a63..5700ed634f 100644 --- a/src/qt/locale/bitcoin_pl.ts +++ b/src/qt/locale/bitcoin_pl.ts @@ -1450,7 +1450,7 @@ Kwota - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Wprowadź adres bitcoinowy (np. %1) diff --git a/src/qt/locale/bitcoin_pt_BR.ts b/src/qt/locale/bitcoin_pt_BR.ts index 8336f33e22..acda653429 100644 --- a/src/qt/locale/bitcoin_pt_BR.ts +++ b/src/qt/locale/bitcoin_pt_BR.ts @@ -1446,7 +1446,7 @@ Quantidade - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Informe um endereço Bitcoin (ex: %1) diff --git a/src/qt/locale/bitcoin_pt_PT.ts b/src/qt/locale/bitcoin_pt_PT.ts index 5677c8075e..46c6d4b4c8 100644 --- a/src/qt/locale/bitcoin_pt_PT.ts +++ b/src/qt/locale/bitcoin_pt_PT.ts @@ -1427,7 +1427,7 @@ Quantia - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Entre um endereço Bitcoin (ex. %1) diff --git a/src/qt/locale/bitcoin_ro_RO.ts b/src/qt/locale/bitcoin_ro_RO.ts index 287b079202..293ad3d815 100644 --- a/src/qt/locale/bitcoin_ro_RO.ts +++ b/src/qt/locale/bitcoin_ro_RO.ts @@ -1426,7 +1426,7 @@ Cantitate - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Introduceţi o adresă Bitcoin (de exemplu %1) diff --git a/src/qt/locale/bitcoin_ru_RU.ts b/src/qt/locale/bitcoin_ru_RU.ts index ea30f39969..ae99fef2f9 100644 --- a/src/qt/locale/bitcoin_ru_RU.ts +++ b/src/qt/locale/bitcoin_ru_RU.ts @@ -1126,7 +1126,7 @@ Количество - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Введите биткоин-адрес (напр. %1) diff --git a/src/qt/locale/bitcoin_sk.ts b/src/qt/locale/bitcoin_sk.ts index 5d68a8d4c2..8d61e1d376 100644 --- a/src/qt/locale/bitcoin_sk.ts +++ b/src/qt/locale/bitcoin_sk.ts @@ -1430,7 +1430,7 @@ Suma - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Zadajte bitcoin adresu (napr. %1) diff --git a/src/qt/locale/bitcoin_sl_SI.ts b/src/qt/locale/bitcoin_sl_SI.ts index 91080a774a..671eb7a250 100644 --- a/src/qt/locale/bitcoin_sl_SI.ts +++ b/src/qt/locale/bitcoin_sl_SI.ts @@ -1044,7 +1044,7 @@ Znesek - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Vnesite naslov Bitcoin (npr. %1): diff --git a/src/qt/locale/bitcoin_sv.ts b/src/qt/locale/bitcoin_sv.ts index d0fcef9297..1bf0cf8ff4 100644 --- a/src/qt/locale/bitcoin_sv.ts +++ b/src/qt/locale/bitcoin_sv.ts @@ -1401,7 +1401,7 @@ Var vänlig och försök igen. Mängd - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Ange en Bitcoin-adress (t.ex. %1) diff --git a/src/qt/locale/bitcoin_tr.ts b/src/qt/locale/bitcoin_tr.ts index b092ee060e..910b3bd472 100644 --- a/src/qt/locale/bitcoin_tr.ts +++ b/src/qt/locale/bitcoin_tr.ts @@ -1388,7 +1388,7 @@ Tutar - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Bir Bitcoin adresi giriniz (mesela %1) diff --git a/src/qt/locale/bitcoin_tr_TR.ts b/src/qt/locale/bitcoin_tr_TR.ts index cf119c65c2..dd29b95f7c 100644 --- a/src/qt/locale/bitcoin_tr_TR.ts +++ b/src/qt/locale/bitcoin_tr_TR.ts @@ -709,7 +709,7 @@ QObject - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Bitcoin adresinizi girin (örneğin %1) diff --git a/src/qt/locale/bitcoin_uk.ts b/src/qt/locale/bitcoin_uk.ts index 8eef258772..60e5f6a5b5 100644 --- a/src/qt/locale/bitcoin_uk.ts +++ b/src/qt/locale/bitcoin_uk.ts @@ -1436,7 +1436,7 @@ Кількість - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Введіть адресу Bitcoin (наприклад %1) diff --git a/src/qt/locale/bitcoin_uz@Cyrl.ts b/src/qt/locale/bitcoin_uz@Cyrl.ts index d369d4f16a..fe44bea1f7 100644 --- a/src/qt/locale/bitcoin_uz@Cyrl.ts +++ b/src/qt/locale/bitcoin_uz@Cyrl.ts @@ -674,7 +674,7 @@ Миқдори - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Bitcoin манзилини киритинг (масалан. %1) diff --git a/src/qt/locale/bitcoin_vi.ts b/src/qt/locale/bitcoin_vi.ts index 563d047ff7..a0f4a9d704 100644 --- a/src/qt/locale/bitcoin_vi.ts +++ b/src/qt/locale/bitcoin_vi.ts @@ -1372,7 +1372,7 @@ Số lượng - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) Nhập một Bitcoin address (e.g. %1) diff --git a/src/qt/locale/bitcoin_zh_CN.ts b/src/qt/locale/bitcoin_zh_CN.ts index 8929ae3f42..3916583814 100644 --- a/src/qt/locale/bitcoin_zh_CN.ts +++ b/src/qt/locale/bitcoin_zh_CN.ts @@ -1381,7 +1381,7 @@ 金额 - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) 请输入一个比特币地址 (例如 %1) diff --git a/src/qt/locale/bitcoin_zh_HK.ts b/src/qt/locale/bitcoin_zh_HK.ts index df77762c6c..80b0611282 100644 --- a/src/qt/locale/bitcoin_zh_HK.ts +++ b/src/qt/locale/bitcoin_zh_HK.ts @@ -468,7 +468,7 @@ QObject - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) 輸入一個 Bitcoin 位址 (例如 %1) diff --git a/src/qt/locale/bitcoin_zh_TW.ts b/src/qt/locale/bitcoin_zh_TW.ts index 75225bd604..76a97c1d0d 100644 --- a/src/qt/locale/bitcoin_zh_TW.ts +++ b/src/qt/locale/bitcoin_zh_TW.ts @@ -1450,7 +1450,7 @@ 金額 - Enter a Bitcoin address (e.g. %1) + Enter a Liquid address (e.g. %1) 輸入 Bitcoin 位址 (比如說 %1) From ab21387c8b9b4bb5f051ec7544d5c14b11bf40f3 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 10 Apr 2019 12:53:31 -0400 Subject: [PATCH 89/97] QT: Always return blinded address --- src/interfaces/wallet.cpp | 4 ++++ src/interfaces/wallet.h | 3 +++ src/qt/addresstablemodel.cpp | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index 53e142c892..f7b3830c6e 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -192,6 +192,10 @@ class WalletImpl : public Wallet return result; } void learnRelatedScripts(const CPubKey& key, OutputType type) override { m_wallet.LearnRelatedScripts(key, type); } + CPubKey getBlindingPubKey(const CScript& script) override + { + return m_wallet.GetBlindingPubKey(script); + } bool addDestData(const CTxDestination& dest, const std::string& key, const std::string& value) override { LOCK(m_wallet.cs_wallet); diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index d608aab0ad..d67861a257 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -111,6 +111,9 @@ class Wallet //! database can detect payments to newer address types. virtual void learnRelatedScripts(const CPubKey& key, OutputType type) = 0; + //! Get blinding pubkey for script + virtual CPubKey getBlindingPubKey(const CScript& script) = 0; + //! Add dest data. virtual bool addDestData(const CTxDestination& dest, const std::string& key, const std::string& value) = 0; diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp index 2f88e15d21..784cc78ce5 100644 --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -380,7 +380,8 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con } } walletModel->wallet().learnRelatedScripts(newKey, address_type); - strAddress = EncodeDestination(GetDestinationForKey(newKey, address_type)); + CPubKey blinding_pubkey = walletModel->wallet().getBlindingPubKey(GetScriptForDestination(GetDestinationForKey(newKey, address_type))); + strAddress = EncodeDestination(GetDestinationForKey(newKey, address_type, blinding_pubkey)); } else { From 8adf591590ffb38cb83333256ade92d48cc7d891 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 10 Apr 2019 12:59:03 -0400 Subject: [PATCH 90/97] QT include linting --- src/qt/bitcoinamountfield.cpp | 6 +++--- src/qt/guiutil.cpp | 2 +- src/qt/guiutil.h | 2 +- src/qt/transactiontablemodel.cpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/qt/bitcoinamountfield.cpp b/src/qt/bitcoinamountfield.cpp index 83ee3fd347..2fa32b0910 100644 --- a/src/qt/bitcoinamountfield.cpp +++ b/src/qt/bitcoinamountfield.cpp @@ -7,10 +7,10 @@ #include #include #include -#include "guiutil.h" +#include -#include "assetsdir.h" -#include "chainparams.h" +#include +#include #include #include diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 03ef2ac485..19d136fe09 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -11,7 +11,7 @@ #include #include -#include "assetsdir.h" +#include #include #include #include diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index c404b9bfbb..d812b731c7 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -7,7 +7,7 @@ #include #include -#include "bitcoinunits.h" +#include #include #include diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 5a423e77e8..72818ca67a 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -13,7 +13,7 @@ #include #include -#include "assetsdir.h" +#include #include #include #include From c299dd24ab3974274cc36ec3fd542abb2e9adc89 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 10 Apr 2019 13:07:24 -0400 Subject: [PATCH 91/97] QT: fix qt linter --- src/qt/sendcoinsentry.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index f3ed74d1ac..21975743ac 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -45,7 +45,7 @@ SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *par // Connect signals connect(ui->payAmount, &BitcoinAmountField::valueChanged, this, &SendCoinsEntry::payAmountChanged); connect(ui->checkboxSubtractFeeFromAmount, &QCheckBox::toggled, this, &SendCoinsEntry::subtractFeeFromAmountChanged); - connect(ui->payAmount, SIGNAL(valueChanged()), this, SLOT(payAmountChangedInternal())); + connect(ui->payAmount, &BitcoinAmountField::valueChanged, this, &SendCoinsEntry::payAmountChangedInternal); connect(ui->deleteButton, &QPushButton::clicked, this, &SendCoinsEntry::deleteClicked); connect(ui->deleteButton_is, &QPushButton::clicked, this, &SendCoinsEntry::deleteClicked); connect(ui->deleteButton_s, &QPushButton::clicked, this, &SendCoinsEntry::deleteClicked); @@ -87,7 +87,7 @@ void SendCoinsEntry::setModel(WalletModel *_model) if (_model && _model->getOptionsModel()) { connect(_model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &SendCoinsEntry::updateDisplayUnit); - connect(_model, SIGNAL(assetTypesChanged()), this, SLOT(updateAssetTypes())); + connect(_model, &WalletModel::assetTypesChanged, this, &SendCoinsEntry::updateAssetTypes); } clear(); From 027aeef83eec1c95d2d98f2ae0b6a4939f504cc2 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 10 Apr 2019 13:17:56 -0400 Subject: [PATCH 92/97] QT: Remove ^M and trailing whitespace --- doc/README_windows.txt | 46 +++++++++++++++++++------------------- src/qt/res/src/bitcoin.svg | 30 ++++++++++++------------- src/qt/splashscreen.cpp | 2 +- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/doc/README_windows.txt b/doc/README_windows.txt index adc1d8ff6c..936a117841 100644 --- a/doc/README_windows.txt +++ b/doc/README_windows.txt @@ -1,23 +1,23 @@ -Bitcoin Core -============= - -Intro ------ -Bitcoin is a free open source peer-to-peer electronic cash system that is -completely decentralized, without the need for a central server or trusted -parties. Users hold the crypto keys to their own money and transact directly -with each other, with the help of a P2P network to check for double-spending. - - -Setup ------ -Unpack the files into a directory and run elements-qt.exe. - -Bitcoin Core is the original Bitcoin client and it builds the backbone of the network. -However, it downloads and stores the entire history of Bitcoin transactions; -depending on the speed of your computer and network connection, the synchronization -process can take anywhere from a few hours to a day or more. - -See the bitcoin wiki at: - https://en.bitcoin.it/wiki/Main_Page -for more help and information. +Bitcoin Core +============= + +Intro +----- +Bitcoin is a free open source peer-to-peer electronic cash system that is +completely decentralized, without the need for a central server or trusted +parties. Users hold the crypto keys to their own money and transact directly +with each other, with the help of a P2P network to check for double-spending. + + +Setup +----- +Unpack the files into a directory and run elements-qt.exe. + +Bitcoin Core is the original Bitcoin client and it builds the backbone of the network. +However, it downloads and stores the entire history of Bitcoin transactions; +depending on the speed of your computer and network connection, the synchronization +process can take anywhere from a few hours to a day or more. + +See the bitcoin wiki at: + https://en.bitcoin.it/wiki/Main_Page +for more help and information. diff --git a/src/qt/res/src/bitcoin.svg b/src/qt/res/src/bitcoin.svg index 082578d299..7727885ddb 100644 --- a/src/qt/res/src/bitcoin.svg +++ b/src/qt/res/src/bitcoin.svg @@ -1,15 +1,15 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp index bcfb56a321..eddd10e0df 100644 --- a/src/qt/splashscreen.cpp +++ b/src/qt/splashscreen.cpp @@ -69,7 +69,7 @@ SplashScreen::SplashScreen(interfaces::Node& node, Qt::WindowFlags f, const Netw pixPaint.fillRect(rGradient, gradient); // draw the bitcoin icon, expected size of PNG: 1024x1024 - int _32 = 32 / devicePixelRatio; + int _32 = 32 / devicePixelRatio; QRect rectIcon(QPoint(_32,-_32/2), QSize(pixmap.size().height()/devicePixelRatio+_32*2,pixmap.size().height()/devicePixelRatio+_32*2)); const QSize requiredSize(1024,1024); From 95d09819795b23dcb0a5e4f2a65d7c5fb74d7118 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 10 Apr 2019 13:53:54 -0400 Subject: [PATCH 93/97] QT: Fix QT to work in non-elementsmode --- src/interfaces/wallet.cpp | 2 +- src/qt/walletmodeltransaction.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index f7b3830c6e..bc1ea2287e 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -250,7 +250,7 @@ class WalletImpl : public Wallet } BlindDetails blind_details; if (!m_wallet.CreateTransaction(recipients, pending->m_tx, pending->m_keys, fee, change_pos, - fail_reason, coin_control, sign, &blind_details)) { + fail_reason, coin_control, sign, g_con_elementsmode ? &blind_details : nullptr)) { return {}; } out_amounts = blind_details.o_amounts; diff --git a/src/qt/walletmodeltransaction.cpp b/src/qt/walletmodeltransaction.cpp index ab473a3fc3..a7085d2e4f 100644 --- a/src/qt/walletmodeltransaction.cpp +++ b/src/qt/walletmodeltransaction.cpp @@ -42,6 +42,7 @@ void WalletModelTransaction::setTransactionFee(const CAmount& newFee) void WalletModelTransaction::reassignAmounts(const std::vector& outAmounts, int nChangePosRet) { + const CTransaction* walletTransaction = &wtx->get(); int i = 0; for (auto it = recipients.begin(); it != recipients.end(); ++it) { @@ -57,7 +58,7 @@ void WalletModelTransaction::reassignAmounts(const std::vector& outAmou if (out.amount() <= 0) continue; if (i == nChangePosRet) i++; - subtotal += outAmounts[i]; + subtotal += g_con_elementsmode ? outAmounts[i] : walletTransaction->vout[i].nValue.GetAmount(); i++; } rcp.asset_amount = subtotal; @@ -66,7 +67,7 @@ void WalletModelTransaction::reassignAmounts(const std::vector& outAmou { if (i == nChangePosRet) i++; - rcp.asset_amount = outAmounts[i]; + rcp.asset_amount = g_con_elementsmode ? outAmounts[i] : walletTransaction->vout[i].nValue.GetAmount(); i++; } } From 962690743fbee95877333194536463b1395af71b Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 10 Apr 2019 13:54:06 -0400 Subject: [PATCH 94/97] QT: Disable URI unit tests since unused --- src/qt/test/uritests.cpp | 2 ++ src/qt/test/wallettests.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/qt/test/uritests.cpp b/src/qt/test/uritests.cpp index b87d3b21ca..88b767e1d8 100644 --- a/src/qt/test/uritests.cpp +++ b/src/qt/test/uritests.cpp @@ -11,6 +11,7 @@ void URITests::uriTests() { + /* Elements doesn't use URI SendCoinsRecipient rv; QUrl uri; uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?req-dontexist=")); @@ -63,4 +64,5 @@ void URITests::uriTests() uri.setUrl(QString("bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=1,000.0&label=Wikipedia Example")); QVERIFY(!GUIUtil::parseBitcoinURI(uri, &rv)); + */ } diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp index 701295ac5d..eab58cdaf9 100644 --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -208,6 +208,8 @@ void TestGUI() requestPaymentButton->click(); for (QWidget* widget : QApplication::topLevelWidgets()) { if (widget->inherits("ReceiveRequestDialog")) { + + /* URI are disabled for Elements-QT ReceiveRequestDialog* receiveRequestDialog = qobject_cast(widget); QTextEdit* rlist = receiveRequestDialog->QObject::findChild("outUri"); QString paymentText = rlist->toPlainText(); @@ -218,6 +220,7 @@ void TestGUI() QCOMPARE(paymentTextList.at(3), QString("Amount: 0.00000001 ") + QString::fromStdString(CURRENCY_UNIT)); QCOMPARE(paymentTextList.at(4), QString("Label: TEST_LABEL_1")); QCOMPARE(paymentTextList.at(5), QString("Message: TEST_MESSAGE_1")); + */ } } From a337b763461ce16a7a392c35c434838fc8893f48 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Wed, 10 Apr 2019 15:01:50 -0400 Subject: [PATCH 95/97] QT: Fixup OSX build --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index ff9c7c36af..c145d307ff 100644 --- a/Makefile.am +++ b/Makefile.am @@ -97,7 +97,7 @@ $(OSX_APP)/Contents/Resources/bitcoin.icns: $(OSX_INSTALLER_ICONS) $(MKDIR_P) $(@D) $(INSTALL_DATA) $< $@ -$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: all-recursive +$(OSX_APP)/Contents/MacOS/Elements-Qt: all-recursive $(MKDIR_P) $(@D) STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_QT_BIN) $@ @@ -107,7 +107,7 @@ $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings: OSX_APP_BUILT=$(OSX_APP)/Contents/PkgInfo $(OSX_APP)/Contents/Resources/empty.lproj \ $(OSX_APP)/Contents/Resources/bitcoin.icns $(OSX_APP)/Contents/Info.plist \ - $(OSX_APP)/Contents/MacOS/Bitcoin-Qt $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings + $(OSX_APP)/Contents/MacOS/Elements-Qt $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings osx_volname: echo $(OSX_VOLNAME) >$@ From 6333166320cdb9b6aa54d02ebbbf904e1f90d26f Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Thu, 11 Apr 2019 07:34:44 -0400 Subject: [PATCH 96/97] QT: get fee directly from elementsmode transactions --- src/qt/bitcoinunits.cpp | 4 ++-- src/qt/transactiondesc.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qt/bitcoinunits.cpp b/src/qt/bitcoinunits.cpp index f96428551e..e9af8bbb5d 100644 --- a/src/qt/bitcoinunits.cpp +++ b/src/qt/bitcoinunits.cpp @@ -54,8 +54,8 @@ QString BitcoinUnits::shortName(int unit) { switch(unit) { - case uBTC: return QString::fromUtf8("bits"); - case SAT: return QString("sat"); + case uBTC: return QString::fromUtf8("L-bits"); + case SAT: return QString("L-sat"); default: return longName(unit); } } diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index 00ba85dcbd..99fa20f66b 100644 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -213,7 +213,7 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall strHTML += "" + tr("Total credit") + ": " + BitcoinUnits::formatHtmlWithUnit(unit, nValue) + "
"; } - CAmount nTxFee = nDebit - valueFor(wtx.tx->GetValueOutMap(), ::policyAsset); + CAmount nTxFee = GetFeeMap(*wtx.tx)[::policyAsset]; if (nTxFee > 0) strHTML += "" + tr("Transaction fee") + ": " + BitcoinUnits::formatHtmlWithUnit(unit, -nTxFee) + "
"; } From 003fb1933eb1d95e9e4fa440c2ba20b61472fc22 Mon Sep 17 00:00:00 2001 From: Gregory Sanders Date: Thu, 11 Apr 2019 14:47:14 -0400 Subject: [PATCH 97/97] QT: Carbon copy 0.14-based transaction accounting --- src/interfaces/wallet.cpp | 1 + src/interfaces/wallet.h | 1 + src/qt/transactionrecord.cpp | 234 +++++++++++++++-------------------- 3 files changed, 99 insertions(+), 137 deletions(-) diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp index bc1ea2287e..af06b8d7a7 100644 --- a/src/interfaces/wallet.cpp +++ b/src/interfaces/wallet.cpp @@ -79,6 +79,7 @@ static WalletTx MakeWalletTx(CWallet& wallet, const CWalletTx& wtx) EXCLUSIVE_LO result.txout_address_is_mine.emplace_back(ExtractDestination(txout.scriptPubKey, result.txout_address.back()) ? IsMine(wallet, result.txout_address.back()) : ISMINE_NO); + result.txout_is_change.push_back(wallet.IsChange(txout)); } // ELEMENTS: Retrieve unblinded information about outputs for (unsigned int i = 0; i < wtx.tx->vout.size(); ++i) { diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index d67861a257..3ad1fc667f 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -337,6 +337,7 @@ struct WalletTx CTransactionRef tx; std::vector txin_is_mine; std::vector txout_is_mine; + std::vector txout_is_change; std::vector txout_address; std::vector txout_address_is_mine; std::vector txout_amounts; diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index ecc0f852db..e20899c89b 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -36,54 +36,21 @@ QList TransactionRecord::decomposeTransaction(const interface uint256 hash = wtx.tx->GetHash(); std::map mapValue = wtx.value_map; - if (nNet > 0 || wtx.is_coinbase) - { - // - // Credit - // - for(unsigned int i = 0; i < wtx.tx->vout.size(); i++) - { - isminetype mine = wtx.txout_is_mine[i]; - if(mine) - { - TransactionRecord sub(hash, nTime); - CTxDestination address; - sub.idx = i; // vout index - sub.amount = wtx.txout_amounts[i]; - sub.involvesWatchAddress = mine & ISMINE_WATCH_ONLY; - if (wtx.txout_address_is_mine[i]) - { - // Received by Bitcoin Address - sub.type = TransactionRecord::RecvWithAddress; - sub.address = EncodeDestination(wtx.txout_address[i]); - sub.asset = wtx.txout_assets[i]; - } - else - { - // Received by IP connection (deprecated features), or a multisignature or other non-simple transaction - sub.type = TransactionRecord::RecvFromOther; - sub.address = mapValue["from"]; - sub.asset = wtx.txout_assets[i]; - } - if (wtx.is_coinbase) - { - // Generated - sub.type = TransactionRecord::Generated; - sub.asset = wtx.txout_assets[i]; - } - - parts.append(sub); - } - } + bool involvesWatchAddress = false; + isminetype fAllFromMe = ISMINE_SPENDABLE; + bool any_from_me = false; + std::set assets_issued_to_me_only; + if (wtx.is_coinbase) { + fAllFromMe = ISMINE_NO; } else { - bool involvesWatchAddress = false; - isminetype fAllFromMe = ISMINE_SPENDABLE; - std::set assets_issued_to_me_only; CAmountMap assets_received_by_me_only; for (unsigned int i = 0; i < wtx.tx->vout.size(); i++) { + if (wtx.tx->vout[i].IsFee()) { + continue; + } const CAsset& asset = wtx.txout_assets[i]; if (assets_received_by_me_only.count(asset) && assets_received_by_me_only.at(asset) < 0) { // Already known to be received by not-me @@ -97,117 +64,71 @@ QList TransactionRecord::decomposeTransaction(const interface } } + any_from_me = false; for (size_t i = 0; i < wtx.tx->vin.size(); ++i) { + /* Issuance detection */ isminetype mine = wtx.txin_is_mine[i]; if(mine & ISMINE_WATCH_ONLY) involvesWatchAddress = true; if(fAllFromMe > mine) fAllFromMe = mine; - const CAsset& asset = wtx.txin_issuance_asset[i]; - const CAmount& asset_amount = wtx.txin_issuance_asset_amount[i]; - const CAsset& token = wtx.txin_issuance_token[i]; - const CAmount& token_amount = wtx.txin_issuance_token_amount[i]; - if (!asset.IsNull()) { - if (assets_received_by_me_only.count(asset) == 0) { - continue; - } - if (asset_amount == assets_received_by_me_only.at(asset)) { - // Special case: collapse the chain of issue, send, receive to just an issue - assets_issued_to_me_only.insert(asset); - continue; - } - - TransactionRecord sub(hash, nTime); - sub.involvesWatchAddress = involvesWatchAddress; - sub.asset = asset; - sub.amount = asset_amount; - sub.type = TransactionRecord::IssuedAsset; - parts.append(sub); - } - if (!token.IsNull()) { - if (assets_received_by_me_only.count(token) == 0) { - continue; + if (mine) any_from_me = true; + CAmountMap assets; + assets[wtx.txin_issuance_asset[i]] = wtx.txin_issuance_asset_amount[i]; + assets[wtx.txin_issuance_token[i]] = wtx.txin_issuance_token_amount[i]; + for (const auto& asset : assets) { + if (!asset.first.IsNull()) { + if (assets_received_by_me_only.count(asset.first) == 0) { + continue; + } + if (asset.second == assets_received_by_me_only.at(asset.first)) { + // Special case: collapse the chain of issue, send, receive to just an issue + assets_issued_to_me_only.insert(asset.first); + continue; + } else { + TransactionRecord sub(hash, nTime); + sub.involvesWatchAddress = involvesWatchAddress; + sub.asset = asset.first; + sub.amount = asset.second; + sub.type = TransactionRecord::IssuedAsset; + parts.append(sub); + } } - if (token_amount == assets_received_by_me_only.at(asset)) { - // Special case: collapse the chain of issue, send, receive to just an issue - assets_issued_to_me_only.insert(asset); - continue; - } - - TransactionRecord sub(hash, nTime); - sub.involvesWatchAddress = involvesWatchAddress; - sub.asset = token; - sub.amount = token_amount; - sub.type = TransactionRecord::IssuedAsset; - parts.append(sub); - } - - if (!wtx.txin_issuance_token[i].IsNull()) { - TransactionRecord sub(hash, nTime); - sub.involvesWatchAddress = involvesWatchAddress; - sub.asset = wtx.txin_issuance_token[i]; - sub.amount = wtx.txin_issuance_token_amount[i]; - sub.type = TransactionRecord::IssuedAsset; - parts.append(sub); } } + } - isminetype fAllToMe = ISMINE_SPENDABLE; - for (unsigned int i = 0; i < wtx.txout_is_mine.size(); ++i) { - const isminetype mine = wtx.txout_is_mine[i]; - const CTxOut txout = wtx.tx->vout[i]; + if (fAllFromMe || !any_from_me) { + for(unsigned int i = 0; i < wtx.tx->vout.size(); i++) + { + const CTxOut& txout = wtx.tx->vout[i]; + const CAsset& asset = wtx.txout_assets[i]; if (txout.IsFee()) { // explicit fee; ignore continue; } - if(mine & ISMINE_WATCH_ONLY) involvesWatchAddress = true; - if(fAllToMe > mine) fAllToMe = mine; - } - - if (fAllFromMe && fAllToMe) - { - // Payment to self - CAmount nChange = valueFor(wtx.change, ::policyAsset); - parts.append(TransactionRecord(hash, nTime, TransactionRecord::SendToSelf, "", - -(nDebit - nChange) + (nCredit - nChange), ::policyAsset)); - parts.last().involvesWatchAddress = involvesWatchAddress; // maybe pass to TransactionRecord as constructor argument - } - else if (fAllFromMe) - { - - // - // Debit - // - - for (unsigned int nOut = 0; nOut < wtx.tx->vout.size(); nOut++) - { - - const CTxOut& txout = wtx.tx->vout[nOut]; - const CAsset& asset = wtx.txout_assets[nOut]; + if (fAllFromMe && assets_issued_to_me_only.count(asset) == 0) { + // Change is only really possible if we're the sender + // Otherwise, someone just sent bitcoins to a change address, which should be shown - if(wtx.txout_is_mine[nOut] || txout.IsFee()) - { - // Ignore parts sent to self, as this is usually the change - // from a transaction sent back to our own address. - continue; - } - - // Short-circuit when it's an issuance to self - if (assets_issued_to_me_only.count(asset) != 0) { + if (wtx.txout_is_change[i]) { continue; } + // + // Debit + // TransactionRecord sub(hash, nTime); - sub.idx = nOut; + sub.idx = i; sub.involvesWatchAddress = involvesWatchAddress; - sub.amount = -wtx.txout_amounts[nOut]; + sub.amount = -wtx.txout_amounts[i]; sub.asset = asset; - if (!boost::get(&wtx.txout_address[nOut])) + if (!boost::get(&wtx.txout_address[i])) { // Sent to Bitcoin Address sub.type = TransactionRecord::SendToAddress; - sub.address = EncodeDestination(wtx.txout_address[nOut]); + sub.address = EncodeDestination(wtx.txout_address[i]); } else { @@ -215,14 +136,53 @@ QList TransactionRecord::decomposeTransaction(const interface sub.type = TransactionRecord::SendToOther; sub.address = mapValue["to"]; } - if (assets_issued_to_me_only.count(asset)) { + parts.append(sub); + } + + isminetype mine = wtx.txout_is_mine[i]; + if(mine) + { + // + // Credit + // + + TransactionRecord sub(hash, nTime); + CTxDestination address; + sub.idx = i; // vout index + sub.amount = wtx.txout_amounts[i]; + sub.involvesWatchAddress = mine & ISMINE_WATCH_ONLY; + if (wtx.txout_address_is_mine[i]) + { + // Received by Bitcoin Address + sub.type = TransactionRecord::RecvWithAddress; + sub.address = EncodeDestination(wtx.txout_address[i]); + sub.asset = asset; + } + else + { + // Received by IP connection (deprecated features), or a multisignature or other non-simple transaction + sub.type = TransactionRecord::RecvFromOther; + sub.address = mapValue["from"]; + sub.asset = wtx.txout_assets[i]; + } + if (wtx.is_coinbase) + { + // Generated + sub.type = TransactionRecord::Generated; + sub.asset = wtx.txout_assets[i]; + } + if (assets_issued_to_me_only.count(wtx.txout_assets[i])) { sub.type = TransactionRecord::IssuedAsset; } + parts.append(sub); } + } + if (fAllFromMe) { for (const auto& tx_fee : GetFeeMap(*wtx.tx)) { if (!tx_fee.second) continue; + TransactionRecord sub(hash, nTime); sub.type = TransactionRecord::Fee; sub.asset = tx_fee.first; @@ -230,14 +190,14 @@ QList TransactionRecord::decomposeTransaction(const interface parts.append(sub); } } - else - { - // - // Mixed debit transaction, can't break down payees - // - parts.append(TransactionRecord(hash, nTime, TransactionRecord::Other, "", nNet, CAsset())); - parts.last().involvesWatchAddress = involvesWatchAddress; - } + } + else + { + // + // Mixed debit transaction, can't break down payees + // + parts.append(TransactionRecord(hash, nTime, TransactionRecord::Other, "", nNet, CAsset())); + parts.last().involvesWatchAddress = involvesWatchAddress; } return parts;