mirror of
https://github.com/aljazceru/cdk.git
synced 2026-02-05 05:06:14 +01:00
chore: remove start up pending mint check
This commit is contained in:
@@ -539,12 +539,6 @@ async fn main() -> anyhow::Result<()> {
|
||||
|
||||
let mint = Arc::new(mint);
|
||||
|
||||
// Check the status of any mint quotes that are pending
|
||||
// In the event that the mint server is down but the ln node is not
|
||||
// it is possible that a mint quote was paid but the mint has not been updated
|
||||
// this will check and update the mint state of those quotes
|
||||
mint.check_pending_mint_quotes().await?;
|
||||
|
||||
// Checks the status of all pending melt quotes
|
||||
// Pending melt quotes where the payment has gone through inputs are burnt
|
||||
// Pending melt quotes where the payment has **failed** inputs are reset to unspent
|
||||
|
||||
@@ -157,28 +157,6 @@ impl Mint {
|
||||
Ok(quotes)
|
||||
}
|
||||
|
||||
/// Get pending mint quotes
|
||||
#[instrument(skip_all)]
|
||||
pub async fn get_pending_mint_quotes(&self) -> Result<Vec<MintQuote>, Error> {
|
||||
let mint_quotes = self
|
||||
.localstore
|
||||
.get_mint_quotes_with_state(MintQuoteState::Pending)
|
||||
.await?;
|
||||
|
||||
Ok(mint_quotes)
|
||||
}
|
||||
|
||||
/// Get pending mint quotes
|
||||
#[instrument(skip_all)]
|
||||
pub async fn get_unpaid_mint_quotes(&self) -> Result<Vec<MintQuote>, Error> {
|
||||
let mint_quotes = self
|
||||
.localstore
|
||||
.get_mint_quotes_with_state(MintQuoteState::Unpaid)
|
||||
.await?;
|
||||
|
||||
Ok(mint_quotes)
|
||||
}
|
||||
|
||||
/// Remove mint quote
|
||||
#[instrument(skip_all)]
|
||||
pub async fn remove_mint_quote(&self, quote_id: &Uuid) -> Result<(), Error> {
|
||||
|
||||
@@ -8,32 +8,6 @@ use crate::mint::{MeltQuote, MeltQuoteState, PaymentMethod};
|
||||
use crate::types::PaymentProcessorKey;
|
||||
|
||||
impl Mint {
|
||||
/// Check the status of all pending and unpaid mint quotes in the mint db
|
||||
/// with all the lighting backends. This check that any payments
|
||||
/// received while the mint was offline are accounted for, and the wallet can mint associated ecash
|
||||
pub async fn check_pending_mint_quotes(&self) -> Result<(), Error> {
|
||||
let pending_quotes = self.get_pending_mint_quotes().await?;
|
||||
let unpaid_quotes = self.get_unpaid_mint_quotes().await?;
|
||||
|
||||
let all_quotes = [pending_quotes, unpaid_quotes].concat();
|
||||
|
||||
tracing::info!(
|
||||
"There are {} pending and unpaid mint quotes.",
|
||||
all_quotes.len()
|
||||
);
|
||||
for mut quote in all_quotes.into_iter() {
|
||||
tracing::debug!("Checking status of mint quote: {}", quote.id);
|
||||
match self
|
||||
.check_mint_quote_paid(self.localstore.begin_transaction().await?, &mut quote)
|
||||
.await
|
||||
{
|
||||
Ok(tx) => tx.commit().await?,
|
||||
Err(err) => tracing::error!("Could not check status of {}, {}", quote.id, err),
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Checks the states of melt quotes that are **PENDING** or **UNKNOWN** to the mint with the ln node
|
||||
pub async fn check_pending_melt_quotes(&self) -> Result<(), Error> {
|
||||
let melt_quotes = self.localstore.get_melt_quotes().await?;
|
||||
|
||||
Reference in New Issue
Block a user