bugfix: List most recent pool utxos
This commit is contained in:
parent
bce825c91b
commit
98ab9a81b3
2 changed files with 16 additions and 15 deletions
|
|
@ -76,8 +76,7 @@ pub fn list_tokens_by_volume(
|
|||
ORDER BY total_trade_volume DESC, tvl_sats DESC
|
||||
LIMIT ?;
|
||||
",
|
||||
)
|
||||
.unwrap();
|
||||
)?;
|
||||
|
||||
let tokens: Vec<(String, u64, u64, u64, u64, u64, u64)> = statement
|
||||
.query_and_then([seconds, limit], |row| {
|
||||
|
|
|
|||
|
|
@ -166,19 +166,21 @@ fn db_list_active_pools(
|
|||
conn: &Connection,
|
||||
) -> Result<Vec<ActivePool>> {
|
||||
let mut query: String = "
|
||||
SELECT
|
||||
p.owner_pkh,
|
||||
uf.sats,
|
||||
uf.token_amount,
|
||||
uf.new_utxo_txid,
|
||||
uf.new_utxo_n,
|
||||
p.token_id
|
||||
|
||||
FROM
|
||||
pool p
|
||||
JOIN utxo_funding uf ON p.creation_utxo = uf.new_utxo_hash
|
||||
WHERE
|
||||
p.withdrawn_in_utxo IS NULL
|
||||
SELECT
|
||||
p.owner_pkh,
|
||||
uf.sats,
|
||||
uf.token_amount,
|
||||
uf.new_utxo_txid,
|
||||
uf.new_utxo_n,
|
||||
p.token_id
|
||||
FROM
|
||||
pool p
|
||||
JOIN pool_history_entry phe ON p.creation_utxo = phe.pool
|
||||
JOIN utxo_funding uf ON phe.utxo = uf.new_utxo_hash
|
||||
LEFT JOIN utxo_spending us ON uf.new_utxo_hash = us.spent_utxo_hash
|
||||
WHERE
|
||||
p.withdrawn_in_utxo IS NULL
|
||||
AND us.spent_utxo_hash IS NULL
|
||||
"
|
||||
.to_string();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue