mirror of
https://github.com/RoboSats/taptrade-core.git
synced 2025-07-19 09:13:39 +00:00
add db handler to remove trade
This commit is contained in:
@ -1,6 +1,3 @@
|
||||
use bitcoin::secp256k1::Scalar;
|
||||
use hex::ToHex;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -379,5 +379,14 @@ pub async fn handle_payout_signature(
|
||||
.broadcast_keyspend_tx(&keyspend_information)
|
||||
.await
|
||||
.map_err(|e| RequestError::CoordinatorError(e.to_string()))?;
|
||||
database
|
||||
.delete_complete_offer(&payload.offer_id_hex)
|
||||
.await
|
||||
.map_err(|e| {
|
||||
RequestError::Database(format!(
|
||||
"Failed to delete complete offer from taken_offers: {}",
|
||||
e.to_string()
|
||||
))
|
||||
})?;
|
||||
Ok(true)
|
||||
}
|
||||
|
@ -1022,4 +1022,12 @@ impl CoordinatorDB {
|
||||
trace!("Toggled processing status for offer {}", offer_id);
|
||||
Ok(result.get::<i64, _>(0) == 1)
|
||||
}
|
||||
|
||||
pub async fn delete_complete_offer(&self, offer_id: &str) -> Result<()> {
|
||||
sqlx::query("DELETE FROM taken_offers WHERE offer_id = ?")
|
||||
.bind(offer_id)
|
||||
.execute(&*self.db_pool)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ use tokio::{
|
||||
sync::{oneshot, Mutex},
|
||||
};
|
||||
use validator::{Validate, ValidationError};
|
||||
use wallet::{escrow_psbt::*, wallet_utils::*, *};
|
||||
use wallet::{wallet_utils::*, *};
|
||||
|
||||
pub struct Coordinator {
|
||||
pub coordinator_db: Arc<CoordinatorDB>,
|
||||
|
Reference in New Issue
Block a user