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.
Message quality measures whether a commit identifies its scope, purpose, rationale, testing, and supporting references. It does not change the security-severity score.
This commit fixes a bug in the Lightning Dev Kit's handling of channel monitor updates that are refused because the channel's funding transaction was already spent on-chain. Previously, such refused updates were persisted as a full monitor…
Durability ordering bug: later MonitorEvent::Completed could imply earlier refused update was persistedRefused monitor update may carry forwarded HTLC preimage, creating risk of inconsistent state across restartAsynchronous persistence tracking gap for refused updates
This commit only adds and modifies test code in rust-lightning. It expands test coverage for a specific edge case in Lightning channel splicing: when a splice transaction gets confirmed before both peers have finished exchanging signatures…
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…
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
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
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.
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 …
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…
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
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
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
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
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`
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
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
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
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
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…
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
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 …
This avoids race conditions where we're unable to properly update an HTLC's state because we need to update its state in the ChannelManager, but the HTLC is stuck in transit from the Channel to ChannelManager::decode_update_add_htlcs. Now the HTLC will atomically go from the Channel to the ChannelManager decode queue under the same lock.
80/100 · StrongMessage clarity
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
AI analysis · Moderate 55/100
This change fixes a timing issue in how the Lightning node hands off payment packets (HTLCs) between two internal components. Previously, an HTLC could be in an in-between state where one part of the code thought it had been forwarded while another part had not yet processed it, potentially leading to inconsistent bookkeeping. The fix moves the handoff so it happens while the same lock is held, making the transition atomic.
Remove wallet argument from FundingTemplate::splice_out
It does not require coin selection, so the wallet argument is not necessary.
65/100 · AdequateMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides an explanatory body
AI analysis · Low 29/100
This commit is a routine API cleanup, not a security fix. It removes an unnecessary wallet/coin-selection argument from the splice_out function because splicing funds out of a Lightning channel only spends from the channel balance and never needs to select wallet inputs. The change refactors shared validation into a helper and makes the function synchronous, but it does not patch any vulnerability and the commit message does not claim it does.
Mirror the ChannelConfig -> ChannelConfigUpdate helper
65/100 · AdequateMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides an explanatory body
AI analysis · Informational 15/100
This commit adds a simple helper that converts a full channel handshake configuration into a partial update object, mirroring an existing helper for another config type. It is a routine code utility with no security relevance visible in the diff or commit message.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides an explanatory body✓ Mentions testing or verification
Why it was queued
fuzzing or regression evidence
AI analysis · Informational 15/100
This commit only adds a new fuzz test target. Fuzz tests are automated tools that feed random or crafted inputs to code to try to make it crash. The commit does not change any production code, so it cannot by itself introduce a security vulnerability or fix one. It is a testing/infrastructure addition.
Lower-priorityNote why we don't use `update_for_new_tip` in offers flow block updby Matt Corallo · 5704e8e7 · Apr 7, 2026 · 1 fileMessage 62 · AdequateInformational 15Details
Commit message · Matt Corallo
Note why we don't use `update_for_new_tip` in offers flow block upd
62/100 · AdequateMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Explains rationale or failure mode! No meaningful explanatory body
AI analysis · Informational 15/100
This commit only adds a two-line comment explaining why a particular helper function is not used in the offers flow code. It does not change any code behavior, fix a bug, or alter security logic.
! Very short subject! Too few words to establish purpose! No meaningful explanatory body
Why it was queued
second-pass: opaque commit message
AI analysis · Informational 15/100
This commit only reformats existing Rust code using 'cargo fmt'. It changes whitespace and line breaks in two files but does not alter any logic, values, or behavior. There is no security relevance.
Bypass channel monitor sync requests when no partition key given
50/100 · ThinMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
AI analysis · Low 30/100
This small patch changes how a Lightning node decides which channel monitors need to be re-synchronized with the blockchain after a restart. Previously, if the node's best-known block height was missing, the code treated that as height 0 and still computed a partition key, which could cause the wrong subset of monitors to sync. Now, if no best height is known, the partition key is treated as absent and the monitor is skipped unless it has pending claims. The fix is more about correctness and avoiding unnecessary/misdirected sync work than a direct theft-of-funds vulnerability, but in a Lightning context monitor-sync bugs can affect safety.
It seems we forgot to ensure `OffersMessageHandler::best_block` is consistently updated, leading to us building invalid blinded payment paths for short-lived payment paths after two weeks without restart.
85/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
AI analysis · Moderate 59/100
This commit fixes a bug where a piece of data called `best_block` was not being updated when new blocks arrived. This data is used when creating private, one-time Lightning payment routes. If it goes stale for more than two weeks, the software could build payment routes that other nodes consider expired or invalid, causing payments to fail. The fix simply updates `best_block` whenever a new block is seen.
Lower-priorityDrop stale DNSSec resolution logic in `OffersMessageFlow`by Matt Corallo · 2637b387 · Apr 7, 2026 · 1 fileMessage 73 · AdequateInformational 17Details
Commit message · Matt Corallo
Drop stale DNSSec resolution logic in `OffersMessageFlow`
In 884158d0914c64df4807c394e3155646dead478d we dropped built-in BIP 353 resolution logic in favor of the `bitcoin-payment-instructions` crate but forgot to do so in the `OffersMessageFlow`. Here we do so.
73/100 · AdequateMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
AI analysis · Informational 17/100
This commit removes leftover, unused code that handled DNS-based human-readable name resolution inside the BOLT12 offers message flow. The project had already switched to an external crate for this job, and this change simply cleans up the stale internal pieces that were accidentally left behind. It is a maintenance/cleanup change, not a security fix for an active vulnerability.
This commit only fixes a comment describing a Lightning Network routing parameter. It changes no actual code logic, so it cannot affect security or behavior.
Lower-priorityCorrectly refer to `pay_for_offer_from_hrn` in `pay_for_offer` docsby Matt Corallo · 39029081 · Apr 3, 2026 · 1 fileMessage 73 · AdequateInformational 16Details
Commit message · Matt Corallo
Correctly refer to `pay_for_offer_from_hrn` in `pay_for_offer` docs
If a `pay_for_offer` call comes in that was for an HRN, downstream code should instead call `pay_for_offer_from_hrn`, not `pay_for_offer`.
73/100 · AdequateMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
AI analysis · Informational 16/100
This commit is a tiny documentation fix. It updates the comment above the `pay_for_offer` function to tell developers to use a related function, `pay_for_offer_from_hrn`, when handling human-readable payment names. No code behavior changed.
Drop `ChannelManager`-built-in BIP 353 resolution logic
Since we shipped the `bitcoin-payment-instructions` crate we generally expect downstream code to use that rather than doing BIP 353 DNS resolutions over onion messages directly from the `ChannelManager`. Thus, in 0.2 we marked `pay_for_offer_from_human_readable_name` deprecated and here remove it in favor of explicit references to the `bitcoin-payment-instructions` crate in documentation.
73/100 · AdequateMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
AI analysis · Informational 15/100
This commit removes an old, already-deprecated feature from the Lightning Dev Kit's core ChannelManager: the ability to pay a BOLT 12 offer by resolving a human-readable BIP 353 name (like an email-style address) through DNS-over-onion-message inside the library. The project now expects users to use a separate, dedicated `bitcoin-payment-instructions` crate for that name resolution instead. The change is a routine API cleanup, not a security fix, and does not introduce any vulnerability.
Lower-prioritychainmon: fixup stale docs mentioning removed funding_txo paramsby Philip Kannegaard Hayes · c1c98049 · Apr 2, 2026 · 1 fileMessage 50 · ThinInformational 15Details
Commit message · Philip Kannegaard Hayes
chainmon: fixup stale docs mentioning removed funding_txo params
50/100 · ThinMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
AI analysis · Informational 15/100
This commit only updates three stale documentation comments in the chain monitor code. The comments previously referred to old function parameters named `funding_txo` (a transaction output identifier) but the actual code now uses `channel_id`. There are no code behavior changes, no bug fixes, and no security implications.
Users can now configure two different max percentages for the channel value that can be allocated to inbound HTLCs, one for announced channels, and another for unannounced channels.
We also bump the default maximums to 25% for announced channels, and 100% for unannounced channels, to bring them closer to what people would expect.
53/100 · ThinMessage clarity
✓ Specific, descriptive subject✓ Provides detailed explanatory context! Too few words to establish purpose
Why it was queued
boot or update path
AI analysis · Low 30/100
This commit is a feature change, not a security bug fix. It splits one setting into two: the maximum share of a channel's value that can be tied up in incoming payments (HTLCs). Announced channels now default to 25% and unannounced (private) channels default to 100%. The change also updates many tests to keep their old behavior by explicitly setting the previous 10% default. There is no direct vulnerability in the diff, but the higher defaults slightly increase funds-at-risk if a node goes offline while many HTLCs are pending.
Lower-priorityWipe empty entries from `actions_blocking_raa_monitor_updates`by Matt Corallo · f14b4b2f · Apr 2, 2026 · 2 filesMessage 83 · StrongLow 34Details
Commit message · Matt Corallo
Wipe empty entries from `actions_blocking_raa_monitor_updates`
In a very specific case, forgetting to do so can lead to a debug assertion failure when we see a double-claim of an HTLC (see the included test).
Found by @joostjager's work on growing the chanmon_consistency fuzzer.
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
fuzzing or regression evidence
AI analysis · Low 34/100
This patch fixes a bug in the Lightning Dev Kit's channel manager where empty entries in a tracking map were not being removed. In a rare sequence of events—when an HTLC is claimed both off-chain and then on-chain—the leftover empty entry could trigger a debug assertion failure (a crash in debug builds) due to what appears to the code as a 'double-claim.' The fix simply deletes the empty map entry after cleaning it up. It was found through fuzzing, not a real-world exploit, and affects only debug builds because it relies on a debug_assert.
Gate all SystemTime::now() and Instant::now() calls in production code with #[cfg(all(feature = "std", not(fuzzing)))] so that fuzz targets produce consistent results regardless of wall-clock time. For each location, the existing no-std fallback (highest_seen_timestamp, None, or a constant) is reused under fuzzing.
Also force deterministic hashing when the fuzzing cfg is active, rather than requiring the LDK_TEST_DETERMINISTIC_HASHES env var.
AI tools were used in preparing this commit.
80/100 · StrongMessage clarity
✓ Descriptive subject✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification
Why it was queued
fuzzing or regression evidence
AI analysis · Informational 19/100
This commit changes how the Lightning Dev Kit code behaves when running under fuzz testing. Normally, the code uses the real wall-clock time and random hashing. Under fuzzing, it now uses fixed fallback values and deterministic hashing so that fuzz tests produce the same results every run. This is a testing-harness improvement, not a fix for an exploitable security bug in production. It does not change behavior for normal users.
Lower-priorityDocument that `Future` callbacks are not reentrant-safeby Matt Corallo · b06ba3fe · Apr 1, 2026 · 1 fileMessage 65 · AdequateLow 26Details
Commit message · Matt Corallo
Document that `Future` callbacks are not reentrant-safe
Claude was complaining about this, and it seems worth documenting, but not worth (and kinda hard to) fix.
65/100 · AdequateMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides an explanatory body
AI analysis · Low 26/100
This commit only adds documentation comments warning that callbacks registered on a Future object must not re-enter the same Future or its Notifier. It does not change any code behavior, fix a bug, or add safeguards. The change suggests a pre-existing reentrancy hazard exists, but it is left unfixed because the authors considered it hard to address and not worth the effort.
Fix misleading comment on counterparty_commitment_txn_on_chain insert
The comment claimed this insert "isn't useful yet" and was only a safety measure for a watchtower race. In practice it is also used by provide_payment_preimage to look up the commitment number when a preimage arrives after the counterparty commitment tx is confirmed.
AI tools were used in preparing this commit.
73/100 · AdequateMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
AI analysis · Informational 15/100
This commit only changes a code comment to accurately describe why a particular data structure is populated. No program logic, data flow, or behavior was altered. It is purely a documentation fix.
The spec's 25/24 multiplier doesn't always satisfy BIP125's relay requirement of an absolute fee increase at low feerates, while a flat +25 sat/kwu increment falls below the spec's 25/24 rule above 600 sat/kwu. Use max(prev + 25, ceil(prev * 25/24)) for our own RBFs to satisfy both constraints, while still accepting the bare 25/24 rule from counterparties.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
68/100 · AdequateMessage clarity
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
AI analysis · Low 47/100
This commit fixes how Lightning Dev Kit calculates the minimum fee rate when a user tries to speed up (RBF) a channel funding or splicing transaction. Previously, the code only required the new fee to be 25/24 of the old fee. At very low fee rates that percentage bump is too small to meet Bitcoin's BIP125 network-relay rule, so the replacement transaction could be rejected by the network and never confirm. The fix now uses the larger of (old fee + 25 sat/kwu) and (25/24 of old fee) for transactions this node creates, while still accepting the bare 25/24 rule from peers. This is a protocol-compliance/robustness fix, not a direct theft or remote-exploitation vulnerability.
Lower-priorityutil: add default_value_vec for defaults without LengthReadableby Carla Kirk-Cohen · 5330f9f4 · Mar 31, 2026 · 1 fileMessage 85 · StrongInformational 19Details
Commit message · Carla Kirk-Cohen
util: add default_value_vec for defaults without LengthReadable
Right now, use of `default_value` requires that the struct implements `LengthReadable` itself. When trying to use `default_value` outside of LDK for `Vec<T>`, your code will run into the orphan rule because it does not own the trait `LengthReadable` or the type `Vec`.
There are various ugly workarounds for this (like using `custom`), but wanting to persist a vec with a default value seems like a common enough use case to justify the change.
85/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
AI analysis · Informational 19/100
This commit adds a new helper macro called default_value_vec to LDK's serialization toolkit. It lets downstream developers store a list (Vec) of items with a fallback default value, without hitting Rust's 'orphan rule' that normally blocks adding serialization traits to standard types like Vec. The change is purely additive and includes unit tests. There is no indication it fixes a security bug or introduces a vulnerability.
Lower-priorityInclude recent blocks in the `synchronize_listeners`-returned cacheby Matt Corallo · 74e1da3c · Mar 30, 2026 · 2 filesMessage 85 · StrongLow 45Details
Commit message · Matt Corallo
Include recent blocks in the `synchronize_listeners`-returned cache
When `synchronize_listeners` runs, it returns a cache of the headers it needed when doing chain difference-finding. This allows us to ensure that when we start running normally we have all the recent headers in case we need them to reorg.
Sadly, in some cases it was returning a mostly-empty cache. Because it was only being filled during block difference reconciliation it would only get a block around each listener's fork point. Worse, because we were calling `disconnect_blocks` with the cache the cache would assume we were reorging against the main chain and drop blocks we actually want.
Instead, we avoid dropping blocks on `disconnect_blocks` calls and ensure we always add connected blocks to the cache.
85/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
AI analysis · Low 45/100
This patch fixes a bug in rust-lightning's initial blockchain synchronization where the header cache returned to callers was often nearly empty. The cache is meant to keep recent block headers so the node can handle chain reorganizations after startup. Because the cache was being incorrectly cleared during synchronization, a node could start normal operation without the recent headers it needs to safely detect and respond to reorgs. This is a correctness/reliability fix in chain-sync logic, not a direct remote-exploitable vulnerability.
Security candidateReturn `BestBlock` when deserializing chain-synced structsby Matt Corallo · 413c937d · Mar 30, 2026 · 11 filesMessage 85 · StrongLow 29Details
Commit message · Matt Corallo
Return `BestBlock` when deserializing chain-synced structs
The deserialization of `ChannelMonitor`, `ChannelManager`, and `OutputSweeper` is implemented for a `(BlockHash, ...)` pair rather than on the object itself. This ensures developers are pushed to think about initial chain sync after deserialization and provides the latest chain sync state conviniently at deserialization-time.
In the previous commit we started storing additional recent block hashes in `BestBlock` for use during initial sync to ensure we can handle reorgs while offline if the chain source loses the reorged-out blocks. Here, we move the deserialization routines to be on a `(BestBlock, ...)` pair instead of `(BlockHash, ...)`, providing access to those recent block hashes at deserialization-time.
85/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
Why it was queued
boot or update path
AI analysis · Low 29/100
This commit changes how Lightning Dev Kit (LDK) deserializes (reloads from disk) important chain-following objects like ChannelMonitor and ChannelManager. Previously, deserialization returned just a single latest block hash paired with the object. Now it returns a BestBlock structure that includes the latest block hash plus a short history of recent block hashes. This is a defensive, API-shaping change intended to make downstream developers handle initial chain sync more safely after a restart, especially if the Bitcoin chain source has lost blocks from a reorganization while the node was offline. It is not a patch for an active exploit; it is a hardening/refactoring change that improves resilience against reorgs during startup.
Lower-priorityMake `UnboundedCache` boundedby Matt Corallo · 09e77347 · Mar 30, 2026 · 3 filesMessage 58 · ThinLow 37Details
Commit message · Matt Corallo
Make `UnboundedCache` bounded
In the previous commit we moved to hard-coding `UnboundedCache` in the `lightning-block-sync` interface. This is great, except that its an unbounded cache that can use arbitrary amounts of memory (though never really all that much - its just headers that come in while we're running).
Here we simply limit the size, and while we're at it give it a more generic `HeaderCache` name.
This commit replaces an unbounded memory cache of Bitcoin block headers with a bounded one, limiting it to about one week's worth of headers. The change prevents the cache from growing without limit during long-running operation, which could otherwise consume increasing amounts of memory. It also renames the cache from UnboundedCache to HeaderCache and slightly adjusts how old headers are removed during chain reorganizations.
AI review queuedPass a `BestBlock` to `init::synchronize_listeners`by Matt Corallo · 2664d599 · Mar 30, 2026 · 4 filesMessage 85 · StrongLow 45Details
Commit message · Matt Corallo
Pass a `BestBlock` to `init::synchronize_listeners`
On restart, LDK expects the chain to be replayed starting from where it was when objects were last serialized. This is fine in the normal case, but if there was a reorg and the node which we were syncing from either resynced or was changed, the last block that we were synced as of might no longer be available. As a result, it becomes impossible to figure out where the fork point is, and thus to replay the chain.
Luckily, changing the block source during a reorg isn't exactly common, but we shouldn't end up with a bricked node.
To address this, `lightning-block-sync` allows the user to pass in `Cache` which can be used to cache recent blocks and thus allow for reorg handling in this case. However, serialization for, and a reasonable default implementation of a `Cache` was never built.
Instead, here, we start taking a different approach. To avoid developers having to persist yet another object, we move `BestBlock` to storing some number of recent block hashes. This allows us to find the fork point with just the serialized state.
In a previous commit, we moved deserialization of various structs to return the `BestBlock` rather than a `BlockHash`. Here we move to actually using it, taking a `BestBlock` in place of `BlockHash` to `init::synchronize_listeners` and walking the `previous_blocks` list to find the fork point rather than relying on the `Cache`.
85/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
Why it was queued
second-pass: broader security terminology
AI analysis · Low 45/100
This commit changes how a Bitcoin Lightning node (LDK) recovers after a restart when the blockchain has split/reorganized. Previously, the node only remembered its last known block hash. If that block was no longer available from the block source after a reorg, the node could get stuck ('bricked'). The fix makes the node keep a short history of recent block hashes inside its stored 'BestBlock' state, so it can find the fork point and replay the chain without relying on an extra cache object. This is a robustness improvement, not a typical exploitable vulnerability.
Lower-priorityAdd `async_poll.rs` to `lightning-block-sync`by Matt Corallo · e68cbb3e · Mar 30, 2026 · 2 filesMessage 68 · AdequateInformational 15Details
Commit message · Matt Corallo
Add `async_poll.rs` to `lightning-block-sync`
In the next commit we'll fetch blocks during initial connection in parallel, which requires a multi-future poller. Here we add a symlink to the existing `lightning` `async_poll.rs` file, making it available in `lightning-block-sync`
68/100 · AdequateMessage clarity
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
AI analysis · Informational 15/100
This commit adds a symlink to an existing internal utility file and makes minor build configuration changes. It is purely a code-organization/refactoring step with no security-relevant behavior change visible in the diff.