From 229ec93b4963fd902ab4b63450fd5262c97a5356 Mon Sep 17 00:00:00 2001 From: bennyhodl Date: Tue, 9 Dec 2025 11:35:20 -0500 Subject: [PATCH] fix: handle 1 confirmation --- .github/workflows/rust.yml | 1 + ddk/src/chain/esplora.rs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8fac904..fc437c8 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -13,6 +13,7 @@ env: BITCOIND_PASS: dlcdevkit ESPLORA_HOST: http://localhost:30000 RPC_WALLET: ddk + NB_CONFIRMATIONS: 6 jobs: clippy: diff --git a/ddk/src/chain/esplora.rs b/ddk/src/chain/esplora.rs index 38dd935..ae6e408 100644 --- a/ddk/src/chain/esplora.rs +++ b/ddk/src/chain/esplora.rs @@ -163,10 +163,12 @@ impl ddk_manager::Blockchain for EsploraClient { .get_height() .await .map_err(esplora_err_to_manager_err)?; - if txn.confirmed { match txn.block_height { - Some(height) => Ok(tip_height - height), + Some(height) => Ok(tip_height + .checked_sub(height) + .map(|diff| diff + 1) + .unwrap_or(0)), None => Ok(0), } } else {