forked from bitcoinafterlife/bal-server
fix: correct locktime threshold, PG stats SUM on TEXT, PG locktime width, and translate Italian error strings
- Bug 1: LOCKTIME_THRESHOLD was 5_000_000 instead of BIP-65 value 500_000_000 - Bug 2: PostgreSQL SUM(our_fees) failed on TEXT column; cast to BIGINT - Bug 3: PostgreSQL locktime INTEGER (i32) widened to BIGINT (i64) with idempotent ALTER - Translate 4 Italian error strings in xpub.rs to English
This commit is contained in:
@@ -624,9 +624,9 @@ pub async fn get_pending_txs(
|
||||
"SELECT txid, tx, locktime, network, status FROM tbl_tx WHERE network = $1 AND status = 0 AND (locktime < $2 OR (locktime > $3 AND locktime < $4))",
|
||||
)
|
||||
.bind(network)
|
||||
.bind(bestblock_height as i32)
|
||||
.bind(locktime_threshold as i32)
|
||||
.bind(bestblock_time as i32)
|
||||
.bind(bestblock_height)
|
||||
.bind(locktime_threshold)
|
||||
.bind(bestblock_time)
|
||||
.fetch_all(p)
|
||||
.await?;
|
||||
|
||||
@@ -634,7 +634,7 @@ pub async fn get_pending_txs(
|
||||
results.push(TxRow {
|
||||
txid: row.try_get("txid")?,
|
||||
tx: row.try_get("tx")?,
|
||||
locktime: row.try_get::<i32, _>("locktime").unwrap_or(0) as i64,
|
||||
locktime: row.try_get::<i64, _>("locktime").unwrap_or(0),
|
||||
network: row.try_get("network")?,
|
||||
status: row.try_get::<i32, _>("status").unwrap_or(0) as i64,
|
||||
});
|
||||
@@ -839,9 +839,9 @@ pub async fn calculate_and_upsert_stats(
|
||||
(SELECT COUNT(*) FROM tbl_tx WHERE status = 0 AND network = $1),
|
||||
(SELECT COUNT(*) FROM tbl_tx WHERE status = 1 AND network = $1),
|
||||
(SELECT COUNT(*) FROM tbl_tx WHERE status = 2 AND network = $1),
|
||||
(SELECT COALESCE(SUM(our_fees),0) FROM tbl_tx WHERE status = 0 AND network = $1),
|
||||
(SELECT COALESCE(SUM(our_fees),0) FROM tbl_tx WHERE status = 1 AND network = $1),
|
||||
(SELECT COALESCE(SUM(our_fees),0) FROM tbl_tx WHERE status = 2 AND network = $1),
|
||||
(SELECT COALESCE(SUM(CAST(our_fees AS BIGINT)),0) FROM tbl_tx WHERE status = 0 AND network = $1),
|
||||
(SELECT COALESCE(SUM(CAST(our_fees AS BIGINT)),0) FROM tbl_tx WHERE status = 1 AND network = $1),
|
||||
(SELECT COALESCE(SUM(CAST(our_fees AS BIGINT)),0) FROM tbl_tx WHERE status = 2 AND network = $1),
|
||||
(SELECT COUNT(DISTINCT tbl_inp.in_txid)
|
||||
FROM tbl_inp
|
||||
JOIN tbl_tx ON tbl_inp.txid = tbl_tx.txid
|
||||
|
||||
Reference in New Issue
Block a user