LDK
← All projectsLightning Dev Kit

rust-lightning

Composable Rust libraries for building Lightning wallets, nodes, and services.

BitcoinCryptographic librariesLightning NetworkNormal
Repository coverage

1924 commits in the local evidence base

Every captured commit receives deterministic security triage and a separate communication-quality score. Security candidates and broader second-pass signals receive full-patch Ollama analysis.

300security candidates261second-pass queue1606AI analyses
175commits · 30 days
261commits · 60 days
636commits · 180 days
1314commits · 365 days
Backfill bands
Aug 5 → Feb 6819 seen18 candidatesComplete
Feb 6 → Jun 6468 seen16 candidatesComplete
Jun 6 → Jul 6128 seen8 candidatesComplete
Jul 6 → Aug 561 seen3 candidatesComplete
Commit communication

Does the history explain itself?

Message quality measures whether a commit identifies its scope, purpose, rationale, testing, and supporting references. It does not change the security-severity score.

71/100 average clarity
704Strong · 80–100
856Adequate · 60–79
302Thin · 40–59
62Opaque · 0–39
3security candidates with opaque commit messaging
Read the scoring rubric →
Developer activity

Who is changing the project?

Public Git author strings; identities are not independently verified.

DeveloperCommitsCandidatesAnalyzedHigh riskMessage avg.
Matt Corallo58679418876
Elias Rohrer15415153667
auto-pr-bot571823287
Jeffrey Czyz19645182169
Wilmer Paulino15945155169
Valentine Wallace15715145169
Leo Nash11613116162
Vincenzo Palazzo11311183
Joost Jager16324162069
elnosh401434059
shaavan22622069
wpaulino2059082
Analysis record

Published AI watches

Last scanned 47 minutes ago

Informational 15 AI analysisMessage 81 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Correct FeeEstimator docs on the 253 sat/kW lower bound

This is a documentation-only edit. It corrects a misleading comment in the code that wrongly claimed all fee estimates returned to LDK are forced to be at least 253 satoshis per 1000 weight units. The new comment clarifies that this minimu…

ea2051feby auto-pr-bot+9−31 file
No security note in commit
Moderate 54 AI analysisMessage 81 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Merge PR 'Track splice confirmation while awaiting tx_signatures' (#5570)

This change fixes a bug in Lightning Dev Kit's splicing logic. During a splice, one side can broadcast the new funding transaction as soon as it has the other side's signatures. Previously, if that transaction confirmed on-chain before the…

State-machine inconsistency in channel funding lifecycleMissing chain-source watch for in-flight splice funding transactionPotential failure to send splice_locked after splice confirms during signature exchange
ca778e61by Matt Corallo+245−32 files
No security note in commit
Moderate 63 AI analysisMessage 81 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Merge PR 'Account for current HTLC fees in dust exposure' (#5690)

This change fixes how Lightning nodes calculate the financial risk from tiny ('dust') HTLCs when the current on-chain fee rate is higher than the node's own local fee estimate. Previously, the code only considered a buffered fee rate when …

Incorrect fee exposure accounting for dust HTLCsPotential to accept HTLCs whose commitment/HTLC-success fees exceed their value under current feerateEconomic griefing / forced-channel-closure cost manipulation
cc798f60by Matt Corallo+108−382 files
No security note in commit
Informational 15 AI analysisMessage 91 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Merge PR 'Replace cloned array literal with slice::from_ref in reload test' (#5689)

This is a one-line code cleanup in a test file. It replaces a cloned array literal with a slice reference to silence a Rust compiler lint. There is no change to production code, no security fix, and no functional behavior change.

03ca832fby Matt Corallo+1−11 file
No security note in commit
Informational 15 AI analysisMessage 91 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Replace cloned array literal with slice::from_ref in reload test

This is a one-line change in a test file to satisfy a Rust linter warning. It replaces a needless clone of a funding transaction with a reference-based slice construction. There is no functional change, no user-facing behavior change, and …

93e0129cby auto-pr-bot+1−11 file
No security note in commit
Informational 12 AI analysisMessage 91 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Merge PR 'Fix CI: rebuild test coin-selection impl and rework reused-ID balance test' (#5684)

This commit is a test-only fix for a broken continuous integration (CI) build. It updates a test mock to match a new function signature and rewrites an existing test to use three nodes instead of two so the test scenario remains valid unde…

17bac68aby Matt Corallo+26−202 files
No security note in commit
Moderate 68 AI analysisMessage 81 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Merge PR 'Guard pending closing signatures before channel_ready' (#5681)

This change fixes a Lightning channel bug where a malicious peer could renegotiate the closing transaction fee while the local node was still waiting for its own signer to produce the final signature. If allowed, the local node might combi…

State-machine guard expansion to prevent fee renegotiation while a closing signature is pendingRisk of combining mismatched signatures across different closing feesRegression test demonstrates malicious peer renegotiation attempt and expected warning rejection
a01273a2by Matt Corallo+169−21 file
No security note in commit
Low 48 AI analysisMessage 81 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Merge PR 'Release wallet UTXOs when FundingBuilder rejects a coin selection' (#5634)

This change fixes a wallet bug in rust-lightning where a UTXO could be selected for a Lightning funding transaction, then rejected because its previous transaction was too large to fit in a Lightning peer message. Previously, that rejectio…

API change to CoinSelectionSource::select_confirmed_utxos adding max_input_prevtx_serialized_lenWalletSync filters UTXOs by prevtx serialized length before selectionFundingBuilder enforces Lightning tx_add_input message-size limit at selection time
56054190by Matt Corallo+148−155 files
No security note in commit
Low 48 AI analysisMessage 81 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Refuse to pay BOLT 12 invoices with records above experimental range

This commit hardens LDK's BOLT 12 payment logic so it refuses to pay invoices containing very large unknown record types (4 billion and up). These records are legal under the Lightning spec, but LDK doesn't understand them, so the change t…

Defensive refusal to pay invoices with unknown high-numbered TLV recordsReuses existing UnknownRequiredFeatures failure path instead of adding a new oneAdds explicit checks before payment state insertion and route construction
2970372fby auto-pr-bot+106−177 files
No security note in commit
Moderate 64 AI analysisMessage 81 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Read invoice TLV records above the experimental range

This commit fixes a backward-compatibility bug in LDK's BOLT 12 invoice parser. A previous change had capped the range of 'experimental' TLV record types at 4 billion, but the Lightning spec imposes no upper bound. As a result, invoices cr…

Backward-compatibility regression in deserialization of persisted channel monitorsDenial-of-service via unreadable monitor blocking all channel monitoringSpec compliance fix: TLV record types have no upper bound
9e28db58by auto-pr-bot+133−84 files
No security note in commit
High 74 AI analysisMessage 81 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Merge PR 'Refuse to sign messages that collide with gossip serializations' (#5677)

This change fixes a security issue where a signed text message could be crafted so that its prefixed form looks exactly like a Lightning 'node_announcement' gossip message. Because both use the same double-SHA256 hash and the same signing …

Signature replay / message confusion between signed messages and gossip announcementsForged `node_announcement` signatures via chosen-prefix message constructionNew validation rejects prefixed messages that deserialize as `UnsignedNodeAnnouncement`
ec40e097by Matt Corallo+74−148 files
Vendor flagged security relevance
Low 37 AI analysisMessage 81 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Merge PR 'Retry a single HTLC before abandoning an unfundable batch' (#5406)

This change fixes a corner case in how the Lightning node tries to claim multiple pending HTLCs (small Bitcoin payments locked in a channel) when the wallet cannot fund a single large batch transaction. Previously, if the multi-HTLC batch …

Funds-recovery robustness improvement: prevents premature abandonment of a single unbatched HTLCChange in error-handling arithmetic from checked_sub/saturating_sub with max(1)New unit tests covering both failed and successful singleton HTLC funding paths
643e8684by wpaulino+119−21 file
No security note in commit
Moderate 54 AI analysisMessage 81 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Merge PR 'Refuse to persist fresh monitors that alias archived monitors' (#5645)

This change prevents a Lightning node from accidentally overwriting an archived copy of a channel's security monitor with a brand-new one that happens to use the same identifier. In the old code, if a new channel reused the same identifier…

Data-loss prevention: stops archived ChannelMonitor from being overwritten by a later channel with the same keySafety guard added to both sync and async persistence pathsPersistence refusal surfaces as InProgress/UnrecoverableError rather than silent overwrite
3c606c11by Matt Corallo+298−332 files
No security note in commit
Moderate 52 AI analysisMessage 86 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Merge PR 'Handle fee multiplication overflow when merging MPP paths' (#5288)

This change fixes a place in the Lightning payment routing code where adding up fees could overflow the maximum number a computer can store in a 64-bit integer. Previously, the code assumed this could never happen and would crash (panic) i…

Integer overflow in fee computationPreviously unreachable!() panic path reachableMPP path merge could trigger overflow
25f8a740by Matt Corallo+42−171 file
No security note in commit
Low 43 AI analysisMessage 81 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Merge PR 'Resume channels stuck awaiting a completed monitor persistence on reload' (#5610)

This commit fixes a bug where a Lightning node could get stuck after restarting. If the node crashed or restarted while it was still saving the initial channel monitor to disk, and that save later finished in another process, the restarted…

Fixes a state-machine stall on node reload that could leave channels non-functionalRemoves an overstrict assertion that would panic on a legitimate post-reload stateAdds explicit detection of monitor persistence completed in a prior process
11815ed1by Matt Corallo+334−74 files
No security note in commit
Informational 15 AI analysisMessage 81 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Merge PR 'Correct KeysManager docs on spliced channels' remote_key derivation' (#5609)

This change only updates documentation and code comments in the Lightning Dev Kit library. It clarifies that a particular key-derivation setting is fixed when a channel is first opened and is not changed by splicing. No code behavior was a…

83a4d243by Matt Corallo+17−91 file
No security note in commit
Informational 15 AI analysisMessage 81 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Merge PR 'Fix DelayedPaymentKey/HtlcKey from_basepoint docs and document justice tx witness script' (#5596)

This commit only changes documentation comments in two source files. It corrects the wording of how certain public keys are derived in the Lightning protocol and adds details about which witness script a signer must use when creating justi…

Documentation-only changeClarifies key derivation semantics for Lightning commitment transactionsClarifies justice transaction witness script requirements for signers
2f832195by Matt Corallo+44−62 files
No security note in commit
Informational 19 AI analysisMessage 81 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Merge PR 'Document that TokioSpawner requires all of LDK in a tokio context' (#5621)

This change only adds documentation comments to a Rust struct. It does not modify any executable code, so it cannot by itself introduce or fix a security vulnerability. The new text warns developers that using TokioSpawner incorrectly can …

Documentation-only changeNo code logic modifiedNo unsafe blocks added
6e555fa2by Matt Corallo+11−01 file
No security note in commit
High 70 AI analysisMessage 91 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Merge PR 'Make custom signers verify holder commitment sigs synchronously' (#5616)

This commit hardens how Lightning Dev Kit handles custom signing modules. Previously, LDK relied on each custom signer to check that the other party's signatures on a holder commitment transaction were valid. The change adds a ready-made v…

New synchronous signature-verification helper for holder commitment transactionsTrait documentation now mandates verification before Ok(()) because LDK acts immediatelyInMemorySigner now validates that holder funding key belongs to signer before signature checks
0e3b6d33by Matt Corallo+324−954 files
Vendor flagged security relevance
Moderate 64 AI analysisMessage 81 · Strong
LDK Lightning Dev Kitrust-lightning BitcoinCryptographic librariesLightning Network

Merge PR 'Refuse channel_ready while the initial funding_signed is pending' (#5612)

This update fixes a corner case in the Lightning Dev Kit where a node could get confused if it received a 'channel_ready' message while still waiting for its own signer to produce the first commitment signature. The patch makes the node re…

State-machine confusion between funding_signed and channel_ready in async signer flowPremature channel_ready could advance counterparty_next_commitment_point before initial commitment is signedPatch closes channel rather than allowing inconsistent commitment state
d68d2235by Matt Corallo+101−12 files
No security note in commit
Repository ledger

Explore captured commits

Expand any commit for its author, full message, clarity score, changed files, triage signals, analysis, and source link.

Security candidateMerge PR 'Report bare BOLT 11 invoice amounts that overflow pico BTC' (#5338)by Matt Corallo · 36e3da0a · Oct 29, 2026 · 3 filesMessage 86 · StrongLow 48Details
Commit message · Matt Corallo

Merge PR 'Report bare BOLT 11 invoice amounts that overflow pico BTC' (#5338)

from bot/5332-bolt11invoice-reads-an-amount-of-7cfdc8 into main

Reviewed-on: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/pulls/5338
Reviewed-by: Matt Corallo <matt@noreply.git.rust-bitcoin.org>

86/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
Why it was queued
memory safetymerge-commit duplicate discount
AI analysis · Low 48/100

This change fixes a bug in how BOLT 11 Lightning invoices handle very large amounts written without a unit suffix (like 'lnbc18446745...'). Previously, such invoices could bypass an overflow check and later cause arithmetic errors or unexpected behavior when the code tried to convert the amount into smaller units. The patch now rejects these oversized amounts both during parsing and when constructing a signed invoice, returning a clear error instead.

AI review queuedMerge PR 'Give keyed-anchor commitments a chance to confirm when funding fails' (#5089)by wpaulino · 871b6dc5 · Oct 28, 2026 · 1 fileMessage 81 · StrongLow 41Details
Commit message · wpaulino

Merge PR 'Give keyed-anchor commitments a chance to confirm when funding fails' (#5089)

from 2026-10-keyed-anchor-commits-can-confirm into main

Reviewed-on: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/pulls/5089
Reviewed-by: wpaulino <wpaulino@noreply.git.rust-bitcoin.org>

81/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
Why it was queued
signing or wallet pathmerge-commit duplicate discountsecond-pass: security-sensitive path
AI analysis · Low 41/100

This change improves how the Lightning node handles a failed funding attempt for a 'bump' transaction used to speed up a channel close. Previously, if funding the child transaction failed, the pre-signed commitment transaction might never be broadcast, potentially leaving funds stuck. Now, for certain modern channel types (keyed-anchor commitments), the node will still broadcast the pre-signed commitment transaction using its own existing fee, giving it a chance to confirm and recover funds. This is a robustness fix rather than a traditional vulnerability patch.

Security candidatePin backtrace to 0.3.76 for rustc 1.82 through 1.87by auto-pr-bot · 2c88e722 · Oct 27, 2026 · 1 fileMessage 91 · StrongInformational 15Details
Commit message · auto-pr-bot

Pin backtrace to 0.3.76 for rustc 1.82 through 1.87

@matt asked in issue #5413:

> @auto-pr-bot please add appropriate CI pins to fix the new CI breakage
> like this:
>
> ```
> cargo test -p lightning --quiet --color always --features backtrace
> error: rustc 1.85.1 is not supported by the following packages:
> addr2line@0.27.1 requires rustc 1.88
> backtrace@0.3.77 requires rustc 1.88.0
> gimli@0.34.0 requires rustc 1.88
> Either upgrade rustc or select compatible dependency versions with
> cargo update <name>@<current-ver> --precise <compatible-ver>
> where <compatible-ver> is the latest version supporting rustc 1.85.1
> ```

backtrace v0.3.77 raised its MSRV to 1.88, dragging addr2line 0.27 and
gimli 0.34, which also require rustc 1.88, into the resolution of our
`backtrace` feature. Pinning backtrace to 0.3.76 downgrades those
transitively to 0.25.1 and 0.32.3, which still support our 1.85 MSRV.

The new pin only applies from rustc 1.82, backtrace 0.3.76's own MSRV,
so the existing 0.3.74 pin still covers the 1.75 fuzz-sanity job, and it
stops applying once rustc reaches 1.88.

Fixes #5413

Requested-by: @matt
Link: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/issues/5413
Authored-By: matt/GLM-5.3-Flash-GGUF:Q4_K_XL <goose@users.noreply.local>

91/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
Why it was queued
access controlupdate trustfuzzing or regression evidence
AI analysis · Informational 15/100

This is a routine build-maintenance change, not a security fix. A newer version of a Rust dependency called 'backtrace' started requiring a newer Rust compiler than the project officially supports, which broke automated tests. The commit pins that dependency to an older compatible version so the test suite can run again. It does not change any code that handles money, network messages, or cryptography.

Security candidateMerge PR 'Don't process monitor events in `get_and_clear_pending_msg_events`' (#5031)by wpaulino · 42e3eb03 · Oct 26, 2026 · 17 filesMessage 81 · StrongLow 45Details
Commit message · wpaulino

Merge PR 'Don't process monitor events in `get_and_clear_pending_msg_events`' (#5031)

from 2026-09-dont-process-mon-evs-on-msg-evs into main

Reviewed-on: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/pulls/5031
Reviewed-by: wpaulino <wpaulino@noreply.git.rust-bitcoin.org>

81/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
Why it was queued
signing or wallet pathboot or update pathmerge-commit duplicate discount
AI analysis · Low 45/100

This change stops one internal function from automatically processing monitor events when the caller only asked for pending message events. It is a cleanup of how background tasks are triggered, not a fix for an externally exploitable bug. Most of the patch is test updates that reorder event checks to match the new behavior.

AI review queuedMerge PR 'Document that P2PKH weight assumes compressed public keys' (#5329)by Matt Corallo · ef55ead8 · Oct 26, 2026 · 1 fileMessage 81 · StrongInformational 19Details
Commit message · Matt Corallo

Merge PR 'Document that P2PKH weight assumes compressed public keys' (#5329)

from bot/5198-bound-p2pkh-input-weight-for-unc-45b6a6 into main

Reviewed-on: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/pulls/5329
Reviewed-by: Matt Corallo <matt@noreply.git.rust-bitcoin.org>

81/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
Why it was queued
signing or wallet pathmerge-commit duplicate discountsecond-pass: security-sensitive path
AI analysis · Informational 19/100

This change only adds a documentation comment explaining that a helper function for creating old-style P2PKH Bitcoin outputs assumes the public key is compressed (33 bytes). The actual code behavior is unchanged; the patch simply warns callers not to use this helper for uncompressed (65-byte) public keys because the resulting transaction fee estimate would be too low. There is no code fix or behavior change.

AI review queuedDocument that P2PKH weight assumes compressed public keysby auto-pr-bot · 041448af · Oct 26, 2026 · 1 fileMessage 81 · StrongInformational 18Details
Commit message · auto-pr-bot

Document that P2PKH weight assumes compressed public keys

@matt asked:

> @auto-pr-bot please "fix" this by simply updating the documentation to
> note that we require compressed public keys.

`Utxo::new_p2pkh` computes `satisfaction_weight` assuming a compressed
33-byte public key is pushed in the scriptSig. A P2PKH output committing
to an uncompressed 65-byte key needs 128 more weight units than budgeted,
which coin selection would not account for. Rather than overpaying 128
WU on every compressed-key input or changing the API to distinguish the
key form, note the compressed-key requirement in the rustdoc.

Fixes #5198

Requested-by: @matt
Link: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/issues/5198#issuecomment-462100
Authored-By: matt/GLM-5.3-Flash-GGUF:Q4_K_XL <goose@users.noreply.local>

81/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
Why it was queued
signing or wallet pathsecond-pass: security-sensitive path
AI analysis · Informational 18/100

This commit only adds a documentation comment to a Rust helper function. It clarifies that the function's built-in fee estimate assumes a compressed public key, and should not be used with older uncompressed keys because the transaction fee estimate would be too low. No code behavior changes, so there is no direct exploit. The practical risk is that a developer who ignores the new warning could create a transaction with insufficient fees if they spend an uncompressed-key P2PKH output.

Security candidateMerge PR 'Verify built invoice signatures and length' (#5306)by benthecarman · 349f4421 · Oct 23, 2026 · 5 filesMessage 91 · StrongModerate 62Details
Commit message · benthecarman

Merge PR 'Verify built invoice signatures and length' (#5306)

from invoice-signing-hardening into main

Reviewed-on: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/pulls/5306
Reviewed-by: joostjager <joostjager@noreply.git.rust-bitcoin.org>

91/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
Why it was queued
signing boundarydefensive validationsigning or wallet pathmerge-commit duplicate discount
AI analysis · Moderate 62/100

This commit hardens how Lightning invoices are created and validated in rust-lightning. It now checks that the digital signature on a freshly built invoice actually matches the invoice contents, and it rejects invoices that would become too long once encoded. Previously, a buggy or malicious signer could produce an invoice with an invalid signature or one that exceeded protocol size limits, which could cause parsing failures or denial-of-service issues for other nodes.

Security candidateMerge PR 'Reject serializing blinded paths with more than 255 hops' (#5254)by Val Wallace · 2f42409d · Oct 22, 2026 · 1 fileMessage 81 · StrongLow 35Details
Commit message · Val Wallace

Merge PR 'Reject serializing blinded paths with more than 255 hops' (#5254)

from bot/5152-reject-overflowing-blinded-path-14a8f7 into main

Reviewed-on: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/pulls/5254
Reviewed-by: Val Wallace <val@noreply.git.rust-bitcoin.org>

81/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
Why it was queued
memory safetymerge-commit duplicate discount
AI analysis · Low 35/100

This change hardens how Lightning blinded payment paths are saved or sent over the wire. Previously, if a path somehow contained more than 255 hops, the code would silently chop the count to fit in a single byte and then write out all hops, causing the receiver to read the wrong number of entries and likely crash or misparse the data. Now it still caps the count but also stops writing after 255 hops, and adds a debug-only assertion to catch the oversized path during development.

AI review queuedMerge PR 'Fix initial debug commitment balances' (#5302)by wpaulino · 45dc0d97 · Oct 21, 2026 · 3 filesMessage 81 · StrongLow 27Details
Commit message · wpaulino

Merge PR 'Fix initial debug commitment balances' (#5302)

from 2026-10-debug-balances into main

Reviewed-on: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/pulls/5302
Reviewed-by: wpaulino <wpaulino@noreply.git.rust-bitcoin.org>

81/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
Why it was queued
signing or wallet pathmerge-commit duplicate discountsecond-pass: security-sensitive path
AI analysis · Low 27/100

This commit fixes an internal accounting check used only in debug builds. The balances recorded at channel creation did not subtract the small reserved funds used for anchor-style Lightning transactions, so the recorded counterparty balance could be slightly too high. In rare splice scenarios this mismatch could make a later sanity check fail and crash a debug build, but it would not affect production releases or allow an attacker to steal funds.

Security candidateMerge PR 'Fix CI: pin tokio; remove 0.0.125 compat tests' (#5299)by Matt Corallo · 243c2f14 · Oct 20, 2026 · 5 filesMessage 91 · StrongInformational 15Details
Commit message · Matt Corallo

Merge PR 'Fix CI: pin tokio; remove 0.0.125 compat tests' (#5299)

from 2026-10-pin-tokio into main

Reviewed-on: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/pulls/5299
Reviewed-by: Matt Corallo <matt@noreply.git.rust-bitcoin.org>

91/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
Why it was queued
access controlmerge-commit duplicate discount
AI analysis · Informational 15/100

This commit is purely a maintenance patch for the project's continuous integration (CI) system. It pins the tokio dependency to an older version for older Rust compilers and removes compatibility tests for a very old LDK release (0.0.125). There is no change to production code, no security fix, and no vulnerability introduced.

AI review queuedRemove LDK 0.0.125 upgrade testsby Valentine Wallace · 6c0b9da3 · Oct 20, 2026 · 2 filesMessage 78 · AdequateInformational 15Details
Commit message · Valentine Wallace

Remove LDK 0.0.125 upgrade tests

LDK 0.0.125 no longer compiles on recent rustc: `!` is now the
never-type fallback in all editions, and an unused, untyped TLV field
in 0.0.125's `CommitmentTransaction` deserialization now infers as
`!`, which doesn't implement `Readable`. As no fixed 0.0.x release
exists, drop `test_125_dangling_post_update_actions` and the
`lightning_0_0_125` dependency.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

78/100 · AdequateMessage clarity
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
Why it was queued
second-pass: broader security terminology
AI analysis · Informational 15/100

This commit simply removes an old compatibility test that no longer compiles with recent Rust compiler versions. It is a test-suite maintenance change, not a fix to any production code or security vulnerability. No security issue is introduced or patched.

Security candidatePin tokio to 1.53.3 on pre-1.85 rustcby Valentine Wallace · c8c138a9 · Oct 20, 2026 · 1 fileMessage 80 · StrongInformational 15Details
Commit message · Valentine Wallace

Pin tokio to 1.53.3 on pre-1.85 rustc

Starting with version 1.54.0, tokio has an MSRV of rustc 1.85. As
tokio is a dependency of our downstream-facing crates (e.g.
lightning-net-tokio), pin it in PIN_RELEASE_DEPS so that the
msrv-no-dev-deps-check build is covered as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

80/100 · StrongMessage clarity
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
Why it was queued
access control
AI analysis · Informational 15/100

This is a routine build-script change that pins the tokio dependency to an older version when using older Rust compilers. It is not a security patch and does not change any production code that handles user data or network traffic.

AI review queuedApply MSRV dependency pins in the tor-connect CI jobby Valentine Wallace · 160aca3d · Oct 20, 2026 · 2 filesMessage 83 · StrongInformational 15Details
Commit message · Valentine Wallace

Apply MSRV dependency pins in the tor-connect CI job

The tor-connect job runs `cargo test` on rustc 1.75 directly rather
than through one of the ci-tests-*.sh scripts, so it never picked up
the MSRV pins from ci-tests-common.sh. Source it before running the
tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

83/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
Why it was queued
second-pass: broader security terminology
AI analysis · Informational 15/100

This change is a build-system fix for the project's continuous integration (CI) testing. The tor-connect test job was not applying the project's minimum-supported Rust version (MSRV) dependency pins, which could cause CI test failures when newer dependency versions require newer Rust features. It is not a security patch for the Lightning protocol or library code.

Security candidateSerialize experimental TLV records in unsigned invoicesby auto-pr-bot · 10296a82 · Oct 20, 2026 · 1 fileMessage 96 · StrongModerate 60Details
Commit message · auto-pr-bot

Serialize experimental TLV records in unsigned invoices

The `Writeable` implementation for `UnsignedBolt12Invoice` emitted only
`bytes`, omitting `experimental_bytes`, even though construction and
parsing include that buffer in `tagged_hash` and `sign` appends it to
the signed invoice. Experimental records inherited from the payer's
signed invoice request, including unknown odd TLV records, were
therefore missing from the byte representation exposed before signing.

@jkczyz asked in issue #5192:

> @auto-pr-bot please open a PR to fix this issue

> `UnsignedBolt12Invoice` deliberately separates experimental records
> into `experimental_bytes`: construction and parsing include that
> buffer in `tagged_hash`, and `sign` appends it to the final signed
> invoice. However, its public `Writeable` implementation emits only
> `self.bytes`. Experimental records inherited from the payer's signed
> invoice request (including unknown odd TLVs) are therefore omitted
> from the byte representation exposed before signing even though they
> are authenticated by the signature and present in the resulting
> `Bolt12Invoice`.
>
> This breaks the documented policy-signing boundary:
> `NodeSigner::sign_bolt12_invoice` implementations are allowed to
> inspect the `UnsignedBolt12Invoice` and reject unexpected content
> before releasing the node key signature. A remote/HSM adapter or
> policy signer that serializes the public `Writeable` value to parse
> or reject extensions sees an incomplete object.
>
> The serialization should write `self.bytes` followed by
> `self.experimental_bytes`, without adding a length prefix, matching
> the exact unsigned TLV stream later signed.

[...]

The regression test inherits the repository's test-only experimental
invoice request field through `respond_with_no_std` and checks that
serialization exposes every TLV record committed by `tagged_hash` and
round-trips to the same hash.

Fixes #5192

Requested-by: @jkczyz
Link: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/issues/5192
Authored-By: matt/GLM-5.3-Flash-GGUF:Q4_K_XL <goose@users.noreply.local>

96/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
Why it was queued
signing boundaryfuzzing or regression evidence
AI analysis · Moderate 60/100

This commit fixes a bug in how an unsigned BOLT 12 invoice was serialized before being signed. The public serialization accidentally dropped experimental/custom data fields that were inherited from the payer's invoice request. Because those fields are still included in the cryptographic hash that gets signed, a signer that inspected only the public serialized bytes would see an incomplete picture and could not reliably enforce policies against unknown extensions. The fix makes the public serialization include both the standard bytes and the experimental bytes, matching what is actually signed.

Security candidateSerialize experimental TLV records in unsigned invoice requestsby auto-pr-bot · cf18377f · Oct 20, 2026 · 1 fileMessage 86 · StrongHigh 72Details
Commit message · auto-pr-bot

Serialize experimental TLV records in unsigned invoice requests

The `Writeable` implementation for `UnsignedInvoiceRequest` emitted only
`bytes`, omitting `experimental_bytes`, even though construction and
parsing include that buffer in `tagged_hash` and `sign` appends it to
the signed invoice request. A signer reviewing the unsigned
serialization before releasing a signature would therefore not see
records that the signature commits to.

@jkczyz asked in issue #5193:

> @auto-pr-bot please open a PR to fix this issue

> `UnsignedInvoiceRequest` stores normal records in `bytes` and
> experimental offer/invoice-request records in `experimental_bytes`.
> Its signing hash is computed over both buffers, and `sign` inserts
> the signature before appending `experimental_bytes` to the final
> request. However, the public `Writeable` implementation emits only
> `bytes`. A custom/HSM policy signer receiving the
> `&UnsignedInvoiceRequest` through `SignInvoiceRequestFn` and
> serializing it for review therefore sees fewer fields than it is
> being asked to authenticate. A malicious offer can carry an unknown
> odd experimental extension: the policy approves the truncated
> serialization, while the returned `InvoiceRequest` includes the
> hidden extension under the payer's valid signature. [...]

Fixes #5193, superseding #5289, an earlier standalone fix for the same
issue. The analogous fix for `UnsignedBolt12Invoice` follows in the
next commit.

Requested-by: @jkczyz
Link: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/issues/5193
Authored-By: matt/GLM-5.3-Flash-GGUF:Q4_K_XL <goose@users.noreply.local>

86/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
Why it was queued
signing boundary
AI analysis · High 72/100

This commit fixes a bug in how unsigned invoice requests were serialized before being signed. The code previously left out experimental extra data, meaning a signer reviewing the request would not see everything their signature would later cover. A malicious offer could hide data in that experimental space, getting a valid signature on content the signer never reviewed. The fix makes the unsigned serialization include both the normal and experimental bytes.

AI review queuedReject serializing blinded paths with more than 255 hopsby auto-pr-bot · ecfcd267 · Oct 16, 2026 · 1 fileMessage 100 · StrongModerate 58Details
Commit message · auto-pr-bot

Reject serializing blinded paths with more than 255 hops

`BlindedPath::write` narrowed the hop count from `usize` to `u8` without
checking it was representable, so a path with 256 or more hops was
serialized as a wrapped `num_hops` byte followed by every hop body. In
BOLT12 fields that concatenate `...*blinded_path` values without
per-path framing, the trailing hop bodies remain inside the signed TLV
value and may be interpreted as additional paths or make the signed
offer/invoice unparsable.

We don't return an error here because it cannot propagate through TLV
encoding: `_encode_tlv!` computes each field's `serialized_length` up
front via an infallible writer, so a `BlindedPath` with too many hops
would panic there rather than surface the error. Instead we
debug-assert the invariant and, in release builds, cap the write at 255
hops so the trailing bodies are dropped rather than corrupting the
enclosing TLV value.

@val asked:

> @auto-pr-bot please open a PR that addresses this issue. No need for a
> test, just `try_into` when converting the blinded hops length to a u8
> on the write side.

and, on the erroring approach:

> @auto-pr-bot the review bot is right. Instead, we should
> `debug_assert` that we're not writing more than `u8::MAX` hops here,
> and only write up to 255 hops.

Fixes #5152

Requested-by: @val
Link: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/issues/5152
Authored-By: ggml-org/GLM-5.3-Flash-GGUF:Q4_K <goose@users.noreply.local>

100/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
Why it was queued
second-pass: broader security terminology
AI analysis · Moderate 58/100

This commit fixes a serialization bug in the way secret routing paths (blinded paths) are written to data messages. Previously, if a path had 256 or more hops, the hop count was silently truncated to fit in a single byte, causing the remaining hop data to spill into the next part of the message. That could corrupt offers/invoices or make them unparseable. The fix caps the written hops at 255 and adds a debug-only assertion to catch the condition during development.

Security candidateMerge PR 'Avoid overflow when averaging liquidity offsets in merge' (#5208)by Matt Corallo · ca77cdfa · Oct 13, 2026 · 1 fileMessage 86 · StrongLow 48Details
Commit message · Matt Corallo

Merge PR 'Avoid overflow when averaging liquidity offsets in merge' (#5208)

from bot/5121-unchecked-u64-addition-in-channe-326b73 into main

Reviewed-on: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/pulls/5208
Reviewed-by: Matt Corallo <matt@noreply.git.rust-bitcoin.org>

86/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
Why it was queued
memory safetymerge-commit duplicate discount
AI analysis · Low 48/100

This patch fixes an arithmetic overflow bug in rust-lightning's payment-path scoring logic. When the software merged two stored estimates of a Lightning channel's available liquidity, it added two large 64-bit numbers together and then divided by two to get an average. If both numbers were near the maximum a u64 can hold, the addition would overflow and wrap around, producing a tiny, wrong average. The fix computes the average safely by dividing each number first, then adding. The commit message and new test explicitly describe this as an overflow risk, especially when data is loaded from disk or untrusted external sources.

AI review queuedMerge PR 'Propagate read errors instead of panicking during deserialization' (#5155)by Matt Corallo · 370d129c · Oct 9, 2026 · 3 filesMessage 81 · StrongLow 47Details
Commit message · Matt Corallo

Merge PR 'Propagate read errors instead of panicking during deserialization' (#5155)

from bot/5093-propagate-read-errors-instead-of-bf13cc into main

Reviewed-on: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/pulls/5155
Reviewed-by: Matt Corallo <matt@noreply.git.rust-bitcoin.org>

81/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
Why it was queued
merge-commit duplicate discountsecond-pass: broader security terminology
AI analysis · Low 47/100

This change fixes three spots where the code would crash (panic) if reading data failed during deserialization. Now these spots return a proper error instead, which is safer and allows the caller to handle the problem gracefully. The included test confirms one of the fixes works for a fake failing reader.

Security candidateMerge PR 'Fix hang in `test_single_channel_multiple_mpp` on busy machines' (#5131)by Matt Corallo · a1eaff1a · Oct 9, 2026 · 11 filesMessage 91 · StrongInformational 14Details
Commit message · Matt Corallo

Merge PR 'Fix hang in `test_single_channel_multiple_mpp` on busy machines' (#5131)

from 2026-10-racy-test into main

Reviewed-on: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/pulls/5131
Reviewed-by: Val Wallace <val@noreply.git.rust-bitcoin.org>

91/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
Why it was queued
cryptography-sensitive pathboot or update pathmerge-commit duplicate discount
AI analysis · Informational 14/100

This commit fixes a flaky test that could hang on busy machines. It does not change production code behavior or fix any security vulnerability in the software itself. The rest of the patch is minor code cleanup, such as switching to newer Rust syntax for formatting strings and constructing vectors.

Security candidateFix new clippy lint complaining about extra `&`s in `format!()`by Matt Corallo · f1498b25 · Oct 9, 2026 · 6 filesMessage 50 · ThinInformational 15Details
Commit message · Matt Corallo

Fix new clippy lint complaining about extra `&`s in `format!()`

50/100 · ThinMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
Why it was queued
cryptography-sensitive path
AI analysis · Informational 15/100

This commit only cleans up Rust formatting strings to satisfy a new Clippy lint. It removes unnecessary ampersands (&) inside format!() and writeln!() calls. There is no change to program logic, no security fix, and no behavior change.

Security candidateFix hang in `test_single_channel_multiple_mpp` on busy machinesby Matt Corallo · e7a51475 · Oct 8, 2026 · 1 fileMessage 100 · StrongInformational 16Details
Commit message · Matt Corallo

Fix hang in `test_single_channel_multiple_mpp` on busy machines

`test_single_channel_multiple_mpp` claims an MPP payment from a
background thread while each `ChannelMonitorUpdate` persistence blocks
until the test sends into an mpsc channel. The claiming thread holds
node 8's per-peer lock while blocked, so the main thread can only take
that lock in the brief window after each update completes.

To fetch the first `commitment_signed`, the main thread called
`get_and_clear_pending_msg_events`, which takes the per-peer lock four
separate times. Only three updates were completed before it had to
return, and under CPU contention the main thread may get the lock only
once per update. It then stayed blocked on the lock while the claiming
thread waited for a write which only a thread spawned after the call
returns would send, hanging the test forever.

Instead, read the pending messages from the peer state directly,
taking the lock only once. Further, complete updates from a background
thread until each call returns, rather than a fixed number of times.
At least two are still completed while fetching the messages, so that
some claims are in the holding cell when the `revoke_and_ack` arrives.
Finally, accept any number of fulfills in each batch at the end, as
that depends on how far the claim got before the `revoke_and_ack` was
handled.

This may or may not be a complete fix, and may or may not make the
test unable to detect the original issue, but at this point it hardly
matters. We want to drop the test entirely in #4552 and its been racy
for so long that its starting to cause other issues.

Fixes #4744

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

100/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference
Why it was queued
boot or update path
AI analysis · Informational 16/100

This change fixes a flaky automated test that could freeze forever on heavily loaded computers. It only touches test code, not the actual Lightning node software that users run, so it has no direct security impact on real deployments.

Security candidateLog blinded route tails without payload bytesby auto-pr-bot · 2b9039e6 · Oct 8, 2026 · 1 fileMessage 76 · AdequateModerate 58Details
Commit message · auto-pr-bot

Log blinded route tails without payload bytes

`DebugRoute` formatted `Path::blinded_tail` with the derived `Debug`,
which emits every `BlindedHop::encrypted_payload` byte as a decimal
list. Routes are logged at INFO by the default router after the
recipient-provided blinded path from a BOLT 12 invoice has been cloned
into them, so a single "Got route" record scaled with—and could largely
consist of—invoice ciphertext chosen by whoever issued the invoice.

Instead, log one line for the tail's blinding point, excess CLTV expiry
delta and final value, one line per Trampoline hop, and one line per
blinded hop carrying its blinded node id and encrypted payload length.
Rendering each hop is then bounded to a fixed ~150 bytes regardless of
the payload size, while staying readable for debugging.

@val reported in #5084:

> `DebugRoute` formats `p.blinded_tail` with derived `Debug`. That
> recursively emits every `BlindedHop::encrypted_payload` byte as a
> decimal list. The default route finder logs this formatter at INFO
> (`Got route`) after cloning the selected recipient-provided blinded
> path into the route, so attempting payment of an attacker-issued BOLT
> 12 invoice can make an ordinary log record scale with—and
> substantially amplify—the invoice ciphertext. [...]

@matt asked:

> @auto-pr-bot please come up with a better way to log these, something
> that's relatively readable, the suggested fix isn't bad.

Requested-by: @matt
Link: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/issues/5084#issuecomment-449421

Fixes #5084

Authored-By: ggml-org/GLM-5.3-Flash-GGUF:Q4_K <goose@users.noreply.local>

76/100 · AdequateMessage clarity
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
Why it was queued
explicit security language
AI analysis · Moderate 58/100

This change fixes a logging issue where paying a BOLT 12 invoice could cause the software to write an unusually large log entry. The previous code printed every byte of encrypted data from the invoice's hidden payment path as a long list of numbers, which could waste disk space, slow down logging, and potentially disrupt log collection systems. The fix prints only a short summary and the length of each encrypted payload instead.

Security candidateMerge PR 'Fail held HTLC failures when force-closing' (#5050)by Matt Corallo · e8c3f656 · Oct 1, 2026 · 6 filesMessage 81 · StrongModerate 60Details
Commit message · Matt Corallo

Merge PR 'Fail held HTLC failures when force-closing' (#5050)

from fail-back-htlc-fc into main

Reviewed-on: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/pulls/5050
Reviewed-by: Matt Corallo <matt@noreply.git.rust-bitcoin.org>

81/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
Why it was queued
boot or update pathmerge-commit duplicate discount
AI analysis · Moderate 60/100

This commit fixes a bug in the Lightning Dev Kit where a forwarded payment could get permanently stuck if a channel was force-closed at exactly the wrong moment. Normally, when the next node in a route rejects a payment, that rejection is held back briefly until the channel state is fully updated. If the channel was force-closed while that rejection was still held back, the rejection could be lost and the payment would never be failed backwards to the sender. The fix hands those held-back failures to the channel's on-chain monitor so they are released once the monitor is updated, preventing stuck payments.

AI review queuedMerge PR 'Credit remote HTLC fulfills on remote HTLC adds' (#5043)by Matt Corallo · 0645450a · Oct 1, 2026 · 3 filesMessage 81 · StrongModerate 59Details
Commit message · Matt Corallo

Merge PR 'Credit remote HTLC fulfills on remote HTLC adds' (#5043)

from 2026-09-credit-htlc-fulfills into main

Reviewed-on: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/pulls/5043
Reviewed-by: Matt Corallo <matt@noreply.git.rust-bitcoin.org>

81/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
Why it was queued
signing or wallet pathmerge-commit duplicate discountsecond-pass: security-sensitive path
AI analysis · Moderate 59/100

This commit fixes how Lightning channels account for money that is about to be freed up when a payment succeeds or fails. Previously, the code could incorrectly let a node spend funds that were not yet actually available, or conversely block legitimate spending. The change makes the balance projection aware of whose turn it is in the commitment dance, so that incoming HTLC fulfillments are credited to the peer's available balance only when appropriate. New tests verify both the bug scenarios and the corrected behavior.

Security candidateFail held HTLC failures when force-closingby elnosh · bfc96786 · Oct 1, 2026 · 6 filesMessage 68 · AdequateModerate 68Details
Commit message · elnosh

Fail held HTLC failures when force-closing

When our counterparty fails an HTLC, the failure is held until the
ChannelMonitorUpdate for their revoke_and_ack completes. If the channel
is force-closed while that update is in-flight, the held failure was
dropped with the Channel. As the ChannelMonitor had already applied the
revocation, the HTLC was in no commitment transaction it tracks either,
so it was never failed, eventually causing a force-close.

Instead, include the held failures in the ChannelForceClosed update and
have the ChannelMonitor fail them via a MonitorEvent::HTLCEvent when
applying it. HTLC monitor events are only released once all updates
have been persisted, so the failure is only acted on once the
revocation is durable.

HTLCs which are still in a commitment transaction the ChannelMonitor
tracks are skipped. This is the case if the update for the revocation
was blocked rather than in-flight, and thus dropped on close, in which
case the counterparty can still claim the HTLC on-chain. Such HTLCs are
resolved like any other HTLC the ChannelMonitor tracks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

68/100 · AdequateMessage clarity
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
Why it was queued
boot or update path
AI analysis · Moderate 68/100

This commit fixes a bug in the Lightning Dev Kit where a forwarded payment failure could get permanently lost if a channel was force-closed at exactly the wrong moment. Previously, when the other side of a channel told us an HTLC (a conditional payment) had failed, that failure was temporarily held until a channel-state update finished. If the channel was force-closed while that update was still in flight, the held failure was discarded. Because the payment was also no longer in any on-chain commitment transaction the node watches, it would never be failed backwards or forwards, eventually causing another force-close. The fix hands those held failures to the ChannelMonitor as part of the force-close update, so they are properly failed once the relevant state updates are durably persisted.