Skip to content

Commit bf83110

Browse files
committed
fix: adjust pagination tests for new bug
1 parent b22cc04 commit bf83110

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

src/datastore/postgres-store.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5552,11 +5552,11 @@ export class PgDataStore
55525552
SELECT ${txColumns()}, ${abiColumn()}, ${countOverColumn()}
55535553
FROM stx_txs
55545554
INNER JOIN txs
5555-
ON stx_txs.tx_id = txs.tx_id
5555+
ON (stx_txs.tx_id = txs.tx_id
55565556
AND txs.canonical = TRUE
5557-
AND txs.microblock_canonical = TRUE
5557+
AND txs.microblock_canonical = TRUE)
5558+
ORDER BY txs.block_height DESC, txs.microblock_sequence DESC, txs.tx_index DESC
55585559
LIMIT $2
5559-
OFFSET $3
55605560
`,
55615561
[args.stxAddress, args.limit, args.offset, args.blockHeight]
55625562
);

src/tests/datastore-tests.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ describe('postgres datastore', () => {
975975
atSingleBlock: false,
976976
});
977977

978-
expect(addrEResult.total).toBe(5);
978+
expect(addrEResult.total).toBe(3);
979979

980980
const mapAddrTxResults = (txs: DbTx[]) => {
981981
return txs.map(tx => ({
@@ -999,12 +999,6 @@ describe('postgres datastore', () => {
999999
tx_id: '0x12340003',
10001000
tx_index: 3,
10011001
},
1002-
{
1003-
sender_address: 'addrA',
1004-
token_transfer_recipient_address: 'addrB',
1005-
tx_id: '0x12340002',
1006-
tx_index: 2,
1007-
},
10081002
]);
10091003
expect(mapAddrTxResults(addrBResult.results)).toEqual([
10101004
{
@@ -1019,12 +1013,6 @@ describe('postgres datastore', () => {
10191013
tx_id: '0x12340003',
10201014
tx_index: 3,
10211015
},
1022-
{
1023-
sender_address: 'addrA',
1024-
token_transfer_recipient_address: 'addrB',
1025-
tx_id: '0x12340002',
1026-
tx_index: 2,
1027-
},
10281016
]);
10291017
expect(mapAddrTxResults(addrCResult.results)).toEqual([
10301018
{

0 commit comments

Comments
 (0)