Skip to content

Commit

Permalink
Merge pull request #566 from thesimplekid/fix_mint_melt_test
Browse files Browse the repository at this point in the history
fix: tests that attempt to mint before payment
  • Loading branch information
thesimplekid authored Jan 28, 2025
2 parents f31ea12 + 70daaec commit e3fb7f9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions crates/cdk-integration-tests/tests/regtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use cdk_integration_tests::init_regtest::{
get_cln_dir, get_lnd_cert_file_path, get_lnd_dir, get_lnd_macaroon_path, get_mint_port,
get_mint_url, get_mint_ws_url, LND_RPC_ADDR, LND_TWO_RPC_ADDR,
};
use cdk_integration_tests::wait_for_mint_to_be_paid;
use futures::{SinkExt, StreamExt};
use lightning_invoice::Bolt11Invoice;
use ln_regtest_rs::ln_client::{ClnClient, LightningClient, LndClient};
Expand Down Expand Up @@ -94,6 +95,8 @@ async fn test_regtest_mint_melt_round_trip() -> Result<()> {

lnd_client.pay_invoice(mint_quote.request).await.unwrap();

wait_for_mint_to_be_paid(&wallet, &mint_quote.id).await?;

let proofs = wallet
.mint(&mint_quote.id, SplitTarget::default(), None)
.await?;
Expand Down Expand Up @@ -176,6 +179,8 @@ async fn test_regtest_mint_melt() -> Result<()> {

lnd_client.pay_invoice(mint_quote.request).await?;

wait_for_mint_to_be_paid(&wallet, &mint_quote.id).await?;

let proofs = wallet
.mint(&mint_quote.id, SplitTarget::default(), None)
.await?;
Expand Down Expand Up @@ -204,6 +209,8 @@ async fn test_restore() -> Result<()> {

lnd_client.pay_invoice(mint_quote.request).await?;

wait_for_mint_to_be_paid(&wallet, &mint_quote.id).await?;

let _mint_amount = wallet
.mint(&mint_quote.id, SplitTarget::default(), None)
.await?;
Expand Down Expand Up @@ -264,6 +271,8 @@ async fn test_pay_invoice_twice() -> Result<()> {
.await
.expect("Could not pay invoice");

wait_for_mint_to_be_paid(&wallet, &mint_quote.id).await?;

let proofs = wallet
.mint(&mint_quote.id, SplitTarget::default(), None)
.await?;
Expand Down Expand Up @@ -318,6 +327,8 @@ async fn test_internal_payment() -> Result<()> {

lnd_client.pay_invoice(mint_quote.request).await?;

wait_for_mint_to_be_paid(&wallet, &mint_quote.id).await?;

let _mint_amount = wallet
.mint(&mint_quote.id, SplitTarget::default(), None)
.await?;
Expand All @@ -342,6 +353,8 @@ async fn test_internal_payment() -> Result<()> {

let _melted = wallet.melt(&melt.id).await.unwrap();

wait_for_mint_to_be_paid(&wallet, &mint_quote.id).await?;

let _wallet_2_mint = wallet_2
.mint(&mint_quote.id, SplitTarget::default(), None)
.await
Expand Down

0 comments on commit e3fb7f9

Please sign in to comment.