Skip to content

Commit

Permalink
Additional fixes for Plomin
Browse files Browse the repository at this point in the history
  • Loading branch information
theeldermillenial committed Jan 6, 2025
1 parent c2bb388 commit 17d4b69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/charli3_dendrite/backend/dbsync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,10 @@ def _get_pool_utxos(

# Get txo from pool script address
datum_selector += """FROM (
SELECT *
SELECT tx_out.*, address.address, address.payment_cred
FROM tx_out
WHERE tx_out.payment_cred = ANY(%(addresses)b)
LEFT JOIN address ON tx_out.address_id = address.id
WHERE address.payment_cred = ANY(%(addresses)b)
) as txo"""

# If assets are specified, select assets
Expand Down Expand Up @@ -400,8 +401,11 @@ def _get_pool_utxos_in_block(self, block_no: int) -> tuple[str, dict]:
datum_selector = (
PoolSelector.select()
+ """
FROM tx_out txo
LEFT JOIN address ON txo.address_id = address.id
FROM (
SELECT txo.*, address.address, address.payment_cred
FROM tx_out txo
LEFT JOIN address ON txo.address_id = address.id
) AS txo
LEFT JOIN tx ON txo.tx_id = tx.id
LEFT JOIN datum ON txo.data_hash = datum.hash
LEFT JOIN block ON tx.block_id = block.id
Expand Down
2 changes: 1 addition & 1 deletion src/charli3_dendrite/backend/dbsync/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PoolSelector(AbstractDBSyncStructure):
def select(cls) -> str:
"""Select SQL query for swap pools."""
return """
SELECT address.address,
SELECT txo.address,
ENCODE(tx.hash, 'hex') as "tx_hash",
txo.index as "tx_index",
EXTRACT(
Expand Down

0 comments on commit 17d4b69

Please sign in to comment.