Skip to content

Commit 099dbe4

Browse files
committed
GUI: TransactionRecord: When time/index/etc match, sort send before receive
1 parent 2d182f7 commit 099dbe4

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/qt/transactionrecord.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,21 @@ void TransactionRecord::updateStatus(const interfaces::WalletTxStatus& wtx, cons
154154
// Determine transaction status
155155

156156
// Sort order, unrecorded transactions sort to the top
157-
status.sortKey = strprintf("%010d-%01d-%010u-%03d",
157+
int typesort;
158+
switch (type) {
159+
case SendToAddress: case SendToOther:
160+
typesort = 2; break;
161+
case RecvWithAddress: case RecvFromOther:
162+
typesort = 3; break;
163+
default:
164+
typesort = 9;
165+
}
166+
status.sortKey = strprintf("%010d-%01d-%010u-%03d-%d",
158167
wtx.block_height,
159168
wtx.is_coinbase ? 1 : 0,
160169
wtx.time_received,
161-
idx);
170+
idx,
171+
typesort);
162172
status.countsForBalance = wtx.is_trusted && !(wtx.blocks_to_maturity > 0);
163173
status.depth = wtx.depth_in_main_chain;
164174
status.m_cur_block_hash = block_hash;

src/qt/transactiontablemodel.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include <core_io.h>
1818
#include <interfaces/handler.h>
19+
#include <tinyformat.h>
1920
#include <uint256.h>
2021

2122
#include <algorithm>
@@ -557,7 +558,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
557558
case Status:
558559
return QString::fromStdString(rec->status.sortKey);
559560
case Date:
560-
return rec->time;
561+
return QString::fromStdString(strprintf("%020s-%s", rec->time, rec->status.sortKey));
561562
case Type:
562563
return formatTxType(rec);
563564
case Watchonly:

0 commit comments

Comments
 (0)