From 68821ff094202c49acc0efb2f9243ec3fb459589 Mon Sep 17 00:00:00 2001 From: djordon Date: Wed, 13 Nov 2024 19:40:28 -0500 Subject: [PATCH] update the queries --- signer/src/storage/postgres.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/signer/src/storage/postgres.rs b/signer/src/storage/postgres.rs index f0df4e809..e322e33cf 100644 --- a/signer/src/storage/postgres.rs +++ b/signer/src/storage/postgres.rs @@ -96,11 +96,11 @@ pub fn extract_relevant_transactions( /// A convenience struct for retrieving a deposit request report #[derive(sqlx::FromRow)] -struct StatusSummary { +struct DepositStatusSummary { /// The current signer may not have a record of their vote for - /// the deposit. When that happens the `is_accepted` and + /// the deposit. When that happens the `can_accept` and /// `can_sign` fields will be None. - is_accepted: Option, + can_accept: Option, /// Whether this signer is a member of the signing set that generated /// the public key locking the deposit. can_sign: Option, @@ -510,7 +510,7 @@ impl PgStore { txid: &model::BitcoinTxId, output_index: u32, signer_public_key: &PublicKey, - ) -> Result, Error> { + ) -> Result, Error> { // We first get the least height for when the deposit request was // confirmed. This height serves as the stopping criteria for the // recursive part of the subsequent query. @@ -520,7 +520,7 @@ impl PgStore { let Some(min_block_height) = min_block_height_fut.await? else { return Ok(None); }; - sqlx::query_as::<_, StatusSummary>( + sqlx::query_as::<_, DepositStatusSummary>( r#" WITH RECURSIVE block_chain AS ( SELECT @@ -542,7 +542,7 @@ impl PgStore { WHERE child.block_height >= $2 ) SELECT - ds.is_accepted + ds.can_accept , ds.can_sign , dr.amount , dr.max_fee @@ -914,7 +914,7 @@ impl super::DbRead for PgStore { deposit_votes AS ( SELECT signer_pub_key AS signer_public_key - , is_accepted + , can_accept AND can_sign AS is_accepted FROM sbtc_signer.deposit_signers AS ds WHERE TRUE AND ds.txid = $2 @@ -1059,7 +1059,7 @@ impl super::DbRead for PgStore { Ok(Some(DepositRequestReport { status, can_sign: summary.can_sign, - is_accepted: summary.is_accepted, + can_accept: summary.can_accept, amount: summary.amount, max_fee: summary.max_fee, lock_time: bitcoin::relative::LockTime::from_consensus(summary.lock_time) @@ -2025,7 +2025,7 @@ impl super::DbWrite for PgStore { ( txid , output_index , signer_pub_key - , is_accepted + , can_accept , can_sign ) VALUES ($1, $2, $3, $4, $5) @@ -2034,7 +2034,7 @@ impl super::DbWrite for PgStore { .bind(decision.txid) .bind(i32::try_from(decision.output_index).map_err(Error::ConversionDatabaseInt)?) .bind(decision.signer_pub_key) - .bind(decision.is_accepted) + .bind(decision.can_accept) .bind(decision.can_sign) .execute(&self.0) .await