diff --git a/src/datastore/pg-store-v2.ts b/src/datastore/pg-store-v2.ts index 236fba9cd..ff866754f 100644 --- a/src/datastore/pg-store-v2.ts +++ b/src/datastore/pg-store-v2.ts @@ -629,7 +629,7 @@ export class PgStoreV2 extends BasePgStoreModule { LIMIT ${limit} OFFSET ${offset} `; - const total = resultQuery.length > 0 ? resultQuery[0].count : 0; + const total = resultQuery[0].count; const parsed = resultQuery.map(r => parseAccountTransferSummaryTxQueryResult(r)); return { total, @@ -958,8 +958,8 @@ export class PgStoreV2 extends BasePgStoreModule { COUNT(*) OVER()::int AS total FROM pox_sets ps INNER JOIN combined_stackers cs ON ps.signing_key = cs.signer_key - WHERE ps.canonical = TRUE - AND ps.cycle_number = ${cycleNumber} + WHERE ps.canonical = TRUE + AND ps.cycle_number = ${cycleNumber} AND ps.signing_key = ${signerKey} ORDER BY locked DESC LIMIT ${limit} diff --git a/tests/api/address.test.ts b/tests/api/address.test.ts index 6f68f4a95..976129226 100644 --- a/tests/api/address.test.ts +++ b/tests/api/address.test.ts @@ -616,6 +616,13 @@ describe('address tests', () => { expect(v2Fetch1offset.type).toBe('application/json'); const v2Fetch1offsetJson = JSON.parse(v2Fetch1offset.text); expect(v2Fetch1offsetJson.total).toBe(7); + const v2Fetch7offset = await supertest(api.server).get( + `/extended/v2/addresses/${testAddr2}/transactions?offset=7` + ); + expect(v2Fetch7offset.status).toBe(200); + expect(v2Fetch7offset.type).toBe('application/json'); + const v2Fetch7offsetJson = JSON.parse(v2Fetch7offset.text); + expect(v2Fetch7offsetJson.total).toBe(7); const v2Fetch2 = await supertest(api.server).get( `/extended/v2/addresses/${testAddr2}/transactions/${v2Fetch1Json.results[0].tx.tx_id}/events?limit=3`