Merge b000ed5ee5 into merged_master (Bitcoin PR bitcoin-core/gui#119)

This commit is contained in:
Byron Hambly 2025-08-04 11:19:17 +02:00
commit cd8ac9c110
No known key found for this signature in database
GPG key ID: DE8F6EA20A661697
4 changed files with 15 additions and 23 deletions

View file

@ -48,9 +48,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
std::set<CAsset> assets_issued_to_me_only;
if (wtx.is_coinbase) {
fAllFromMe = ISMINE_NO;
}
else
{
} else {
CAmountMap assets_received_by_me_only;
for (unsigned int i = 0; i < wtx.tx->vout.size(); i++)
{
@ -104,6 +102,11 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
}
if (fAllFromMe || !any_from_me) {
for (const isminetype mine : wtx.txout_is_mine)
{
if(mine & ISMINE_WATCH_ONLY) involvesWatchAddress = true;
}
for(unsigned int i = 0; i < wtx.tx->vout.size(); i++)
{
const CTxOut& txout = wtx.tx->vout[i];
@ -116,7 +119,6 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
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_change[i]) {
continue;
}
@ -124,6 +126,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
//
// Debit
//
TransactionRecord sub(hash, nTime);
sub.idx = i;
sub.involvesWatchAddress = involvesWatchAddress;
@ -142,6 +145,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
sub.type = TransactionRecord::SendToOther;
sub.address = mapValue["to"];
}
parts.append(sub);
}
@ -183,7 +187,6 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
parts.append(sub);
}
}
if (fAllFromMe) {
for (const auto& tx_fee : GetFeeMap(*wtx.tx)) {
if (!tx_fee.second) continue;
@ -221,15 +224,10 @@ void TransactionRecord::updateStatus(const interfaces::WalletTxStatus& wtx, cons
case IssuedAsset:
typesort = 1;
break;
case SendToAddress:
case SendToOther:
case SendToSelf:
typesort = 2;
break;
case RecvWithAddress:
case RecvFromOther:
typesort = 3;
break;
case SendToAddress: case SendToOther:
typesort = 2; break;
case RecvWithAddress: case RecvFromOther:
typesort = 3; break;
default:
typesort = 10;
}

View file

@ -70,7 +70,6 @@ public:
SendToOther,
RecvWithAddress,
RecvFromOther,
SendToSelf,
Fee,
IssuedAsset,
};

View file

@ -18,6 +18,7 @@
#include <assetsdir.h>
#include <core_io.h>
#include <interfaces/handler.h>
#include <tinyformat.h>
#include <uint256.h>
#include <policy/policy.h>
@ -373,8 +374,6 @@ QString TransactionTableModel::formatTxType(const TransactionRecord *wtx) const
case TransactionRecord::SendToAddress:
case TransactionRecord::SendToOther:
return tr("Sent to");
case TransactionRecord::SendToSelf:
return tr("Payment to yourself");
case TransactionRecord::Generated:
return tr("Mined");
case TransactionRecord::Fee:
@ -424,8 +423,6 @@ QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, b
return lookupAddress(wtx->address, tooltip) + watchAddress;
case TransactionRecord::SendToOther:
return QString::fromStdString(wtx->address) + watchAddress;
case TransactionRecord::SendToSelf:
return lookupAddress(wtx->address, tooltip) + watchAddress;
default:
return tr("(n/a)") + watchAddress;
}
@ -445,8 +442,6 @@ QVariant TransactionTableModel::addressColor(const TransactionRecord *wtx) const
if(label.isEmpty())
return COLOR_BAREADDRESS;
} break;
case TransactionRecord::SendToSelf:
return COLOR_BAREADDRESS;
default:
break;
}
@ -564,7 +559,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
case Status:
return QString::fromStdString(rec->status.sortKey);
case Date:
return QString::fromStdString(strprintf("%020-%s", rec->time, rec->status.sortKey));
return QString::fromStdString(strprintf("%020s-%s", rec->time, rec->status.sortKey));
case Type:
return formatTxType(rec);
case Watchonly:

View file

@ -73,11 +73,11 @@ WalletTx MakeWalletTx(CWallet& wallet, const CWalletTx& wtx)
result.txout_address_is_mine.reserve(wtx.tx->vout.size());
for (const auto& txout : wtx.tx->vout) {
result.txout_is_mine.emplace_back(wallet.IsMine(txout));
result.txout_is_change.push_back(OutputIsChange(wallet, txout));
result.txout_address.emplace_back();
result.txout_address_is_mine.emplace_back(ExtractDestination(txout.scriptPubKey, result.txout_address.back()) ?
wallet.IsMine(result.txout_address.back()) :
ISMINE_NO);
result.txout_is_change.push_back(OutputIsChange(wallet, txout));
}
// ELEMENTS: Retrieve unblinded information about outputs
for (unsigned int i = 0; i < wtx.tx->vout.size(); ++i) {