GUI: TransactionRecord: When time/index/etc match, sort send before receive

pull/28545/head
Luke Dashjr 6 years ago
parent 2d182f77cd
commit 099dbe4224

@ -154,11 +154,21 @@ void TransactionRecord::updateStatus(const interfaces::WalletTxStatus& wtx, cons
// Determine transaction status // Determine transaction status
// Sort order, unrecorded transactions sort to the top // Sort order, unrecorded transactions sort to the top
status.sortKey = strprintf("%010d-%01d-%010u-%03d", int typesort;
switch (type) {
case SendToAddress: case SendToOther:
typesort = 2; break;
case RecvWithAddress: case RecvFromOther:
typesort = 3; break;
default:
typesort = 9;
}
status.sortKey = strprintf("%010d-%01d-%010u-%03d-%d",
wtx.block_height, wtx.block_height,
wtx.is_coinbase ? 1 : 0, wtx.is_coinbase ? 1 : 0,
wtx.time_received, wtx.time_received,
idx); idx,
typesort);
status.countsForBalance = wtx.is_trusted && !(wtx.blocks_to_maturity > 0); status.countsForBalance = wtx.is_trusted && !(wtx.blocks_to_maturity > 0);
status.depth = wtx.depth_in_main_chain; status.depth = wtx.depth_in_main_chain;
status.m_cur_block_hash = block_hash; status.m_cur_block_hash = block_hash;

@ -16,6 +16,7 @@
#include <core_io.h> #include <core_io.h>
#include <interfaces/handler.h> #include <interfaces/handler.h>
#include <tinyformat.h>
#include <uint256.h> #include <uint256.h>
#include <algorithm> #include <algorithm>
@ -557,7 +558,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
case Status: case Status:
return QString::fromStdString(rec->status.sortKey); return QString::fromStdString(rec->status.sortKey);
case Date: case Date:
return rec->time; return QString::fromStdString(strprintf("%020s-%s", rec->time, rec->status.sortKey));
case Type: case Type:
return formatTxType(rec); return formatTxType(rec);
case Watchonly: case Watchonly:

Loading…
Cancel
Save