Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: tests that attempt to mint before payment #566

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading