Merge pull request #814 from mempool/simon/block-transactions-sorting-fix

Sort block transactions first by height and then time
This commit is contained in:
wiz 2021-09-27 04:04:46 +09:00 committed by GitHub
commit 92b69657da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -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;

View File

@ -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;