Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

31 changes: 9 additions & 22 deletions crates/tap-agent/src/agent/sender_accounts_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,17 +415,11 @@ impl State {
FROM scalar_tap_receipts
GROUP BY signer_address, allocation_id
)
SELECT DISTINCT
SELECT
signer_address,
(
SELECT ARRAY
(
SELECT DISTINCT allocation_id
FROM grouped
WHERE signer_address = top.signer_address
)
) AS allocation_ids
FROM grouped AS top
ARRAY_AGG(allocation_id) AS allocation_ids
FROM grouped
GROUP BY signer_address
"#
)
.fetch_all(&self.pgpool)
Expand Down Expand Up @@ -461,18 +455,11 @@ impl State {

let nonfinal_ravs_sender_allocations_in_db = sqlx::query!(
r#"
SELECT DISTINCT
SELECT
sender_address,
(
SELECT ARRAY
(
SELECT DISTINCT allocation_id
FROM scalar_tap_ravs
WHERE sender_address = top.sender_address
AND NOT last
)
) AS allocation_id
FROM scalar_tap_ravs AS top
ARRAY_AGG(DISTINCT allocation_id) FILTER (WHERE NOT last) AS allocation_ids
FROM scalar_tap_ravs
GROUP BY sender_address
"#
)
.fetch_all(&self.pgpool)
Expand All @@ -481,7 +468,7 @@ impl State {

for row in nonfinal_ravs_sender_allocations_in_db {
let allocation_ids = row
.allocation_id
.allocation_ids
.expect("all RAVs should have an allocation_id")
.iter()
.map(|allocation_id| {
Expand Down
1 change: 1 addition & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ psql-down:

migrate:
sqlx migrate run --database-url postgresql://postgres:[email protected]:5432

Loading