From 102de7345d93d6b3e49d91d88b44417821906b12 Mon Sep 17 00:00:00 2001 From: daywalker90 Date: Sun, 9 Aug 2026 16:46:14 +0200 Subject: [PATCH] fix holdinvoice always having 0 deadline --- src/nwc_notifications.rs | 2 +- tests/test_cln-nip47.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/nwc_notifications.rs b/src/nwc_notifications.rs index 61ec787..302ba96 100644 --- a/src/nwc_notifications.rs +++ b/src/nwc_notifications.rs @@ -538,7 +538,7 @@ pub async fn holdinvoice_accepted_handler( let payment_hash_hash = Sha256::from_str(&payment_hash_str)?; - let mut lowest_htlc_expiry = 0; + let mut lowest_htlc_expiry = u32::MAX; for peer in list_peer_channels { if let Some(htlcs) = peer.htlcs { diff --git a/tests/test_cln-nip47.py b/tests/test_cln-nip47.py index 9e225d9..b463ad6 100644 --- a/tests/test_cln-nip47.py +++ b/tests/test_cln-nip47.py @@ -1376,6 +1376,8 @@ async def test_hold_invoice( assert lookup_hold.state.name == "PENDING" assert lookup_hold.settled_at is None + getinfo = l2.rpc.getinfo() + (responses2, _res) = await fetch_event_responses( client, client_pubkey, @@ -1394,6 +1396,10 @@ async def test_hold_invoice( if content["notification_type"] == "hold_invoice_accepted": hold_events.append(content) assert content["notification"]["payment_hash"] == payment_hash + assert len(hold_events) == 1 + assert ( + hold_events[0]["notification"]["settle_deadline"] > getinfo["blockheight"] + 1 + ) lookup_hold = await nwc.lookup_invoice( LookupInvoiceRequest(