From ffa18bbe71e21afb9719898ca88824b6e40b702f Mon Sep 17 00:00:00 2001 From: softsimon Date: Sat, 25 Sep 2021 16:28:11 +0400 Subject: [PATCH] Sort block transactions first by height and then time fixes #770 --- frontend/src/app/components/address/address.component.ts | 8 +++++++- frontend/src/app/components/asset/asset.component.ts | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/components/address/address.component.ts b/frontend/src/app/components/address/address.component.ts index 32a8b58ef..40a5924ec 100644 --- a/frontend/src/app/components/address/address.component.ts +++ b/frontend/src/app/components/address/address.component.ts @@ -142,7 +142,13 @@ export class AddressComponent implements OnInit, OnDestroy { this.tempTransactions[this.timeTxIndexes[index]].firstSeen = time; }); this.tempTransactions.sort((a, b) => { - return b.status.block_time - a.status.block_time || b.firstSeen - a.firstSeen; + if (b.status.confirmed) { + if (b.status.block_height === a.status.block_height) { + return b.status.block_time - a.status.block_time; + } + return b.status.block_height - a.status.block_height; + } + return b.firstSeen - a.firstSeen; }); this.transactions = this.tempTransactions; diff --git a/frontend/src/app/components/asset/asset.component.ts b/frontend/src/app/components/asset/asset.component.ts index 6fbf7cdf7..e54a3727e 100644 --- a/frontend/src/app/components/asset/asset.component.ts +++ b/frontend/src/app/components/asset/asset.component.ts @@ -136,7 +136,13 @@ export class AssetComponent implements OnInit, OnDestroy { this.tempTransactions[this.timeTxIndexes[index]].firstSeen = time; }); this.tempTransactions.sort((a, b) => { - return b.status.block_time - a.status.block_time || b.firstSeen - a.firstSeen; + if (b.status.confirmed) { + if (b.status.block_height === a.status.block_height) { + return b.status.block_time - a.status.block_time; + } + return b.status.block_height - a.status.block_height; + } + return b.firstSeen - a.firstSeen; }); this.transactions = this.tempTransactions;