mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-22 23:25:22 +01:00
fix: creating auth keyset when auth disabled
This commit is contained in:
@@ -26,7 +26,7 @@ pub async fn check_pending(multi_mint_wallet: &MultiMintWallet) -> Result<()> {
|
|||||||
// Try to reclaim any proofs that are no longer pending
|
// Try to reclaim any proofs that are no longer pending
|
||||||
match wallet.reclaim_unspent(pending_proofs).await {
|
match wallet.reclaim_unspent(pending_proofs).await {
|
||||||
Ok(()) => println!("Successfully reclaimed pending proofs"),
|
Ok(()) => println!("Successfully reclaimed pending proofs"),
|
||||||
Err(e) => println!("Error reclaimed pending proofs: {}", e),
|
Err(e) => println!("Error reclaimed pending proofs: {e}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ impl DbSignatory {
|
|||||||
pub async fn new(
|
pub async fn new(
|
||||||
localstore: Arc<dyn database::MintKeysDatabase<Err = database::Error> + Send + Sync>,
|
localstore: Arc<dyn database::MintKeysDatabase<Err = database::Error> + Send + Sync>,
|
||||||
seed: &[u8],
|
seed: &[u8],
|
||||||
mut supported_units: HashMap<CurrencyUnit, (u64, u8)>,
|
supported_units: HashMap<CurrencyUnit, (u64, u8)>,
|
||||||
custom_paths: HashMap<CurrencyUnit, DerivationPath>,
|
custom_paths: HashMap<CurrencyUnit, DerivationPath>,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
let secp_ctx = Secp256k1::new();
|
let secp_ctx = Secp256k1::new();
|
||||||
@@ -52,8 +52,6 @@ impl DbSignatory {
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
supported_units.entry(CurrencyUnit::Auth).or_insert((0, 1));
|
|
||||||
|
|
||||||
// Create new keysets for supported units that aren't covered by the current keysets
|
// Create new keysets for supported units that aren't covered by the current keysets
|
||||||
for (unit, (fee, max_order)) in supported_units {
|
for (unit, (fee, max_order)) in supported_units {
|
||||||
if !active_keyset_units.contains(&unit) {
|
if !active_keyset_units.contains(&unit) {
|
||||||
|
|||||||
@@ -340,6 +340,14 @@ impl MintBuilder {
|
|||||||
.ok_or(anyhow!("Localstore not set"))?;
|
.ok_or(anyhow!("Localstore not set"))?;
|
||||||
let ln = self.ln.clone().ok_or(anyhow!("Ln backends not set"))?;
|
let ln = self.ln.clone().ok_or(anyhow!("Ln backends not set"))?;
|
||||||
|
|
||||||
|
#[allow(unused_mut)]
|
||||||
|
let mut supported_units = self.supported_units.clone();
|
||||||
|
|
||||||
|
#[cfg(feature = "auth")]
|
||||||
|
if self.openid_discovery.is_some() {
|
||||||
|
supported_units.entry(CurrencyUnit::Auth).or_insert((0, 1));
|
||||||
|
}
|
||||||
|
|
||||||
let signatory = if let Some(signatory) = self.signatory.as_ref() {
|
let signatory = if let Some(signatory) = self.signatory.as_ref() {
|
||||||
signatory.clone()
|
signatory.clone()
|
||||||
} else {
|
} else {
|
||||||
@@ -347,7 +355,7 @@ impl MintBuilder {
|
|||||||
let in_memory_signatory = cdk_signatory::db_signatory::DbSignatory::new(
|
let in_memory_signatory = cdk_signatory::db_signatory::DbSignatory::new(
|
||||||
self.keystore.clone().ok_or(anyhow!("keystore not set"))?,
|
self.keystore.clone().ok_or(anyhow!("keystore not set"))?,
|
||||||
seed,
|
seed,
|
||||||
self.supported_units.clone(),
|
supported_units,
|
||||||
HashMap::new(),
|
HashMap::new(),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|||||||
Reference in New Issue
Block a user