@@ -2051,19 +2051,25 @@ export class PgStore extends BasePgStore {
20512051 > `
20522052 WITH ordered_pox_events AS (
20532053 SELECT
2054- stacker, pox_addr, amount_ustx, unlock_burn_height::integer, tx_id,
2054+ stacker, pox_addr, amount_ustx, unlock_burn_height::integer, tx_id, name,
20552055 block_height, microblock_sequence, tx_index, event_index
20562056 FROM ${ sql ( args . poxTable ) }
20572057 WHERE
2058- canonical = true AND microblock_canonical = true AND
2059- name = ${ SyntheticPoxEventName . DelegateStx } AND delegate_to = ${ args . delegator } AND
2060- block_height <= ${ args . blockHeight } AND block_height > ${ args . afterBlockHeight } AND
2061- (unlock_burn_height > ${ args . burnBlockHeight } OR unlock_burn_height IS NULL)
2058+ canonical = true
2059+ AND microblock_canonical = true
2060+ AND delegate_to = ${ args . delegator }
2061+ AND name IN (
2062+ ${ SyntheticPoxEventName . DelegateStx } ,
2063+ ${ SyntheticPoxEventName . RevokeDelegateStx }
2064+ )
2065+ AND block_height <= ${ args . blockHeight }
2066+ AND block_height > ${ args . afterBlockHeight }
2067+ AND (unlock_burn_height > ${ args . burnBlockHeight } OR unlock_burn_height IS NULL)
20622068 ORDER BY stacker, block_height DESC, microblock_sequence DESC, tx_index DESC, event_index DESC
20632069 ),
20642070 distinct_rows AS (
20652071 SELECT DISTINCT ON (stacker)
2066- stacker, pox_addr, amount_ustx, unlock_burn_height, tx_id,
2072+ stacker, pox_addr, amount_ustx, unlock_burn_height, tx_id, name,
20672073 block_height, microblock_sequence, tx_index, event_index
20682074 FROM ordered_pox_events
20692075 ORDER BY stacker, block_height DESC, microblock_sequence DESC, tx_index DESC, event_index DESC
@@ -2072,6 +2078,7 @@ export class PgStore extends BasePgStore {
20722078 stacker, pox_addr, amount_ustx, unlock_burn_height, block_height::integer, tx_id,
20732079 COUNT(*) OVER()::integer AS total_rows
20742080 FROM distinct_rows
2081+ WHERE name = ${ SyntheticPoxEventName . DelegateStx }
20752082 ORDER BY block_height DESC, microblock_sequence DESC, tx_index DESC, event_index DESC
20762083 LIMIT ${ args . limit }
20772084 OFFSET ${ args . offset }
0 commit comments