bug: Fix 'active' pools showing old instance
This commit is contained in:
parent
3da5b62c24
commit
7ab3e1960b
1 changed files with 10 additions and 1 deletions
|
|
@ -162,6 +162,7 @@ struct ActivePool {
|
||||||
tokens: u64,
|
tokens: u64,
|
||||||
txid: String,
|
txid: String,
|
||||||
tx_pos: u32,
|
tx_pos: u32,
|
||||||
|
pool_id: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn db_list_active_pools(
|
fn db_list_active_pools(
|
||||||
|
|
@ -190,10 +191,16 @@ fn db_list_active_pools(
|
||||||
phe.token_amount,
|
phe.token_amount,
|
||||||
phe.txid,
|
phe.txid,
|
||||||
phe.tx_pos,
|
phe.tx_pos,
|
||||||
p.token_id
|
p.token_id,
|
||||||
|
p.creation_utxo
|
||||||
FROM
|
FROM
|
||||||
pool p
|
pool p
|
||||||
JOIN pool_history_entry phe ON p.creation_utxo = phe.pool
|
JOIN pool_history_entry phe ON p.creation_utxo = phe.pool
|
||||||
|
JOIN (
|
||||||
|
SELECT pool, MAX(sequence) AS max_sequence
|
||||||
|
FROM pool_history_entry
|
||||||
|
GROUP BY pool
|
||||||
|
) max_phe ON phe.pool = max_phe.pool AND phe.sequence = max_phe.max_sequence
|
||||||
WHERE
|
WHERE
|
||||||
p.withdrawn_in_utxo IS NULL
|
p.withdrawn_in_utxo IS NULL
|
||||||
{filters}
|
{filters}
|
||||||
|
|
@ -215,6 +222,7 @@ fn db_list_active_pools(
|
||||||
let txid = row.get(3)?;
|
let txid = row.get(3)?;
|
||||||
let tx_pos = row.get(4)?;
|
let tx_pos = row.get(4)?;
|
||||||
let token_id = row.get(5)?;
|
let token_id = row.get(5)?;
|
||||||
|
let pool_id = row.get(6)?;
|
||||||
|
|
||||||
let pkh = hex::decode(&owner_pkh).context("failed to decode ownerpkh")?;
|
let pkh = hex::decode(&owner_pkh).context("failed to decode ownerpkh")?;
|
||||||
let owner_p2pkh_addr = cashaddr::encode(
|
let owner_p2pkh_addr = cashaddr::encode(
|
||||||
|
|
@ -232,6 +240,7 @@ fn db_list_active_pools(
|
||||||
tokens,
|
tokens,
|
||||||
txid,
|
txid,
|
||||||
tx_pos,
|
tx_pos,
|
||||||
|
pool_id,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Ok(pools)
|
Ok(pools)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue