diff --git a/crates/cdk-integration-tests/tests/mint.rs b/crates/cdk-integration-tests/tests/mint.rs index 03c0ceaa9..615beb9d8 100644 --- a/crates/cdk-integration-tests/tests/mint.rs +++ b/crates/cdk-integration-tests/tests/mint.rs @@ -22,13 +22,10 @@ use cdk::subscription::{IndexableParams, Params}; use cdk::util::unix_time; use cdk::Mint; use cdk_fake_wallet::FakeWallet; -use tokio::sync::OnceCell; use tokio::time::sleep; pub const MINT_URL: &str = "http://127.0.0.1:8088"; -static INSTANCE: OnceCell> = OnceCell::const_new(); - async fn new_mint(fee: u64) -> Mint { let mut supported_units = HashMap::new(); supported_units.insert(CurrencyUnit::Sat, (fee, 32)); @@ -70,13 +67,6 @@ async fn new_mint(fee: u64) -> Mint { .unwrap() } -async fn initialize() -> Arc { - INSTANCE - .get_or_init(|| async { Arc::new(new_mint(0).await) }) - .await - .clone() -} - async fn mint_proofs( mint: &Mint, amount: Amount, @@ -121,7 +111,7 @@ async fn mint_proofs( #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn test_mint_double_spend() -> Result<()> { - let mint = initialize().await; + let mint = new_mint(0).await; let keys = mint.pubkeys().await?.keysets.first().unwrap().clone().keys; let keyset_id = Id::from(&keys); @@ -132,9 +122,7 @@ async fn test_mint_double_spend() -> Result<()> { let swap_request = SwapRequest::new(proofs.clone(), preswap.blinded_messages()); - let swap = mint.process_swap_request(swap_request).await; - - assert!(swap.is_ok()); + mint.process_swap_request(swap_request).await?; let preswap_two = PreMintSecrets::random(keyset_id, 100.into(), &SplitTarget::default())?; @@ -155,7 +143,7 @@ async fn test_mint_double_spend() -> Result<()> { /// This will work if the mint does not check for outputs amounts overflowing #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn test_attempt_to_swap_by_overflowing() -> Result<()> { - let mint = initialize().await; + let mint = new_mint(0).await; let keys = mint.pubkeys().await?.keysets.first().unwrap().clone().keys; let keyset_id = Id::from(&keys); @@ -192,7 +180,7 @@ async fn test_attempt_to_swap_by_overflowing() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] pub async fn test_p2pk_swap() -> Result<()> { - let mint = initialize().await; + let mint = new_mint(0).await; let keys = mint.pubkeys().await?.keysets.first().unwrap().clone().keys; let keyset_id = Id::from(&keys); @@ -310,7 +298,7 @@ pub async fn test_p2pk_swap() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn test_swap_unbalanced() -> Result<()> { - let mint = initialize().await; + let mint = new_mint(0).await; let keys = mint.pubkeys().await?.keysets.first().unwrap().clone().keys; let keyset_id = Id::from(&keys);