Skip to content

Commit

Permalink
added buffer comparison into sort for getTransactionsByTime (#5709)
Browse files Browse the repository at this point in the history
Co-authored-by: Jason Kuroda <[email protected]>
  • Loading branch information
j-s-n and Jason Kuroda authored Jan 23, 2025
1 parent 127a626 commit 500a87f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ironfish/src/wallet/account/account.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2598,7 +2598,8 @@ describe('Accounts', () => {
expect(accountBTx).toHaveLength(2)

// tx1 and tx2 will have the same timestamp for accountB, so ordering should be reverse by hash
const sortedHashes = [tx1.hash(), tx2.hash()].sort().reverse()

const sortedHashes = [tx1.hash(), tx2.hash()].sort((a, b) => b.compare(a))

expect(accountBTx[0].transaction.hash()).toEqualHash(sortedHashes[0])
expect(accountBTx[1].transaction.hash()).toEqualHash(sortedHashes[1])
Expand All @@ -2616,7 +2617,7 @@ describe('Accounts', () => {
expect(accountATxChronological).toHaveLength(5)

// tx1 and tx2 will have the same timestamp for accountB, so ordering should be reverse by hash
const sortedHashesChron = [tx1.hash(), tx2.hash()].sort()
const sortedHashesChron = [tx1.hash(), tx2.hash()].sort((a, b) => a.compare(b))

expect(accountBTxChronological[0].transaction.hash()).toEqualHash(sortedHashesChron[0])
expect(accountBTxChronological[1].transaction.hash()).toEqualHash(sortedHashesChron[1])
Expand Down

0 comments on commit 500a87f

Please sign in to comment.