Skip to content

Commit

Permalink
fix: non-inclusive end_cycle_id filtering on stacking events
Browse files Browse the repository at this point in the history
  • Loading branch information
zone117x committed Jun 4, 2024
1 parent 037c6df commit 3f5408f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/datastore/pg-store-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ export class PgStoreV2 extends BasePgStoreModule {
AND main.microblock_canonical = true
AND main.name IN ('delegate-stack-stx', 'delegate-stack-increase', 'delegate-stack-extend')
AND main.start_cycle_id <= ${args.cycle_number}
AND main.end_cycle_id >= ${args.cycle_number}
AND main.end_cycle_id > ${args.cycle_number}
ORDER BY main.stacker, main.block_height DESC, main.microblock_sequence DESC, main.tx_index DESC, main.event_index DESC
), solo_stackers AS (
SELECT DISTINCT ON (stacker)
Expand All @@ -657,7 +657,7 @@ export class PgStoreV2 extends BasePgStoreModule {
WHERE canonical = true AND microblock_canonical = true
AND name in ('stack-stx', 'stacks-increase', 'stack-extend')
AND start_cycle_id <= ${args.cycle_number}
AND end_cycle_id >= ${args.cycle_number}
AND end_cycle_id > ${args.cycle_number}
ORDER BY stacker, block_height DESC, microblock_sequence DESC, tx_index DESC, event_index DESC
)
SELECT
Expand Down Expand Up @@ -712,7 +712,7 @@ export class PgStoreV2 extends BasePgStoreModule {
AND main.microblock_canonical = true
AND main.name IN ('delegate-stack-stx', 'delegate-stack-increase', 'delegate-stack-extend')
AND main.start_cycle_id <= ${args.cycle_number}
AND main.end_cycle_id >= ${args.cycle_number}
AND main.end_cycle_id > ${args.cycle_number}
ORDER BY main.stacker, main.block_height DESC, main.microblock_sequence DESC, main.tx_index DESC, main.event_index DESC
), solo_stackers AS (
SELECT DISTINCT ON (stacker)
Expand All @@ -722,7 +722,7 @@ export class PgStoreV2 extends BasePgStoreModule {
WHERE canonical = true AND microblock_canonical = true
AND name in ('stack-stx', 'stacks-increase', 'stack-extend')
AND start_cycle_id <= ${args.cycle_number}
AND end_cycle_id >= ${args.cycle_number}
AND end_cycle_id > ${args.cycle_number}
ORDER BY stacker, block_height DESC, microblock_sequence DESC, tx_index DESC, event_index DESC
)
SELECT
Expand Down Expand Up @@ -792,7 +792,7 @@ export class PgStoreV2 extends BasePgStoreModule {
AND main.microblock_canonical = true
AND main.name IN ('delegate-stack-stx', 'delegate-stack-increase', 'delegate-stack-extend')
AND main.start_cycle_id <= ${args.cycle_number}
AND main.end_cycle_id >= ${args.cycle_number}
AND main.end_cycle_id > ${args.cycle_number}
ORDER BY main.stacker, main.block_height DESC, main.microblock_sequence DESC, main.tx_index DESC, main.event_index DESC
), solo_stackers AS (
SELECT DISTINCT ON (stacker)
Expand All @@ -807,7 +807,7 @@ export class PgStoreV2 extends BasePgStoreModule {
WHERE canonical = true AND microblock_canonical = true
AND name in ('stack-stx', 'stacks-increase', 'stack-extend')
AND start_cycle_id <= ${args.cycle_number}
AND end_cycle_id >= ${args.cycle_number}
AND end_cycle_id > ${args.cycle_number}
ORDER BY stacker, block_height DESC, microblock_sequence DESC, tx_index DESC, event_index DESC
), combined_stackers AS (
SELECT * FROM delegated_stackers
Expand Down

0 comments on commit 3f5408f

Please sign in to comment.