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 LND's channel database where a specific type of fee update could be lost if a node restarted at a very precise moment during a Lightning channel's setup. If triggered, the node would reject a valid signature from…
Force-closure of a Lightning channel due to state desynchronization after restartLoss of locally initiated fee updates before first local revocationRegression test reproduces restart scenario leading to signature rejection
This commit fixes bugs in LND's new RBF-style cooperative channel close feature. Previously, fee-bump requests could be dropped or block the peer's main goroutine while waiting for an in-progress offer. The patch buffers those requests ins…
Denial-of-service / liveness fix: fee-bump requests no longer block the peer's `channelManager` goroutine while waiting for an in-flight offer.State consistency fix: buffered fee-bump requests are now part of the FSM state instead of being dropped during shutdown or flush.Resource-leak fix: confirmed RBF closes now tear down the active channel state and switch link for both local and remote-initiated closes.
This change fixes a wallet synchronization check in LND. Previously, the wallet only compared block heights to decide if it was fully caught up with the Bitcoin chain. During a chain reorganization (a temporary fork where one block is repl…
State synchronization check previously used height only, which is insufficient across reorgsFix adds block hash comparison to prevent false-positive sync statusCould cause LND to proceed while wallet state reflects an invalidated or not-yet-updated chain tip
This commit fixes a missing permission check on a new Lightning routing RPC called XFindBaseLocalChanAlias. Without the entry, any valid macaroon could call that RPC, bypassing the normal access-control list. The patch adds the required pe…
Missing macaroon authorization entry for an RPC endpointPotential privilege escalation: any valid macaroon could invoke an unprotected RPCRegression test added to enforce macPermissions coverage
This large LND patch changes when an ordinary invoice is considered 'paid'. Previously, releasing the preimage (the secret that lets the payer claim the funds) immediately marked the invoice as settled. Now the invoice enters a new interme…
New intermediate invoice/HTLC state prevents premature settlement reportingOn-chain HTLC outcomes persisted without opt-in to support restart recoveryForwarding package marker persisted before preimage release to avoid replay rejection on restart
This commit only adds documentation to the release notes. It describes a previously merged code change (PR 11555) about how LND handles invoice finality, but the commit itself contains no code, bug fixes, or behavior changes. There is noth…
This change fixes a bug in LND's invoice handling for multi-part payments (MPP and AMP). When a payment is split into several pieces (HTLCs), each piece is accepted individually. Previously, an old accepted piece could become too close to …
Fixes missing revalidation of accepted HTLC CLTV expiries at MPP/AMP set completionPrevents settlement of shards whose on-chain claim window has become unsafe while heldAdds new fail resolution ResultHtlcSetExpiryTooSoon and cancels the entire affected set
This commit changes how LND's wallet locks (leases) unspent coins through its RPC interface. It removes a recently added 'release after N confirmations' option and replaces it with an explicit 'no expiry' flag. Old clients that still send …
Breaking API change that reserves removed protobuf fields to prevent accidental reintroductionExplicit rejection of legacy `release_after_spend_confs` parameters from old clients instead of silent fallbackValidation prevents conflicting no-expiry + duration lease settings before wallet state is touched
This commit refactors how the Lightning Network Daemon (LND) stores and queries channel graph data so that the same channel or node can exist under both old (v1) and new (v2) gossip protocols without the database returning stale, missing, …
Cross-version data consistency: prevents a v2 channel shell from shadowing a usable v1 channel, which could affect routing decisions and RPC output.Cache consistency: ensures the in-memory pathfinding cache and the SQL-backed RPC reads agree on which channel version and policies are active.Bug fix: zombie edge info now carries the correct channel ID instead of 0, which could have caused incorrect channel identification during resurrection.
This is a large bug-fix patch for LND (a Bitcoin Lightning Network node) that tightens correctness rules across many subsystems. It prevents several ways a node could mis-handle channel data, accept bad network gossip, commit corrupted dat…
Database transaction commit now aborts on read errors (etcd) - prevents silent data corruption / inconsistent stateGossip zombie marking removed for invalid funding script - prevents denial-of-service / channel graph poisoningWire message length bounding added to watchtower protocol - prevents memory exhaustion / malformed message parsing
This commit changes how LND handles multi-part Lightning payments when one part fails after the preimage was already released. Previously, the invoice could be marked as fully paid even if one shard was later reclaimed by the payer on-chai…
Changes invoice settlement semantics for released-but-failed HTLCsAdds new persisted HTLC state `HtlcStateFailed`Prevents invoice from reaching `ContractSettled` when any released shard fails
This change tightens the rules for opening Lightning payment channels by refusing a setting called the CSV delay when it is set to zero. The CSV delay is the waiting period a user must endure before reclaiming their own funds from a channe…
Rejects a zero CSV delay that would eliminate the breach-remedy windowCentralizes the check in VerifyConstraints so all channel types and directions are coveredAdds explicit error type and unit test for the new constraint
This commit fixes two bugs in how Lightning Network channel data is saved to disk. First, it stops extra 'aux' signatures meant only for advanced taproot channels from being saved on ordinary channels, where they don't belong. Second, it p…
Persisted state could become unreadable due to writer/reader size mismatchAuxiliary signatures for taproot overlay channels were persisted on plain channel HTLCsFix adds explicit serialization bound to prevent unreadable channel records
This commit adds the first end-to-end BOLT 12 'Offers' flow to LND: a new dev-only RPC and CLI command to create offers, plus a dispatcher that listens for incoming onion-message invoice requests and replies with signed BOLT 12 invoices. I…
New network-facing dispatcher answers invoice requests from any peer; rate and concurrency limits are appliedBlinded-path PathID check prevents reply linking to self-created paths, but TODO notes the check should move once offers can have offer_pathsCreateOffer RPC is restricted to dev builds and requires offchain:write macaroon permission
This change fixes a bug in LND's invoice handling for AMP (Atomic Multi-Path) payments. Previously, if someone tried to pay a fresh shard for an AMP set that was already fully paid, the invoice updater could return an internal error that w…
Denial-of-service vector: an internal updater error could force-fail a shared channel link, disrupting unrelated sibling HTLCsAMP invoice state machine edge case: reusable invoice stays open for other sets but must reject new shards for already-settled setsClean failure path introduced: ResultInvoiceNotOpen instead of error-driven link failure
This is a large feature merge for LND that adds a new optional RPC subsystem called switchrpc. It lets an external program hand a pre-built onion packet to LND for direct dispatch over a Lightning channel, instead of LND doing its own path…
New optional RPC surface (switchrpc) that accepts externally crafted onion packets and directly dispatches HTLCsIdempotency/deduplication added via InitAttempt durable write-ahead log and ErrPaymentIDAlreadyExistsStartup orphan cleanup fails half-open or pre-commit attempts to avoid hangs
This commit fixes a bug in LND's transaction sweeping logic. Previously, if the Bitcoin backend rejected a sweep transaction for a temporary or unknown reason (for example, the mempool was full, a network error occurred, or the rejection r…
Funds-availability / liveness fix: temporary or unknown mempool rejections could leave sweep inputs unspent.Error-handling reclassification: previously fatal errors now retryable.Retry metadata preservation: next fee rate and fee cap kept across attempts.
This change is a hardening fix for LND's remote-signing feature. Previously, if a node was configured to act as an outbound remote signer but was compiled without the required 'signrpc' and 'walletrpc' sub-servers, it would silently fall b…
silent-degradation-to-no-op preventedconfiguration-misconfiguration now surfaces as fatal errorbuild-tag-dependency explicitly validated at runtime
This commit only fixes blank-line spacing in a single test file to satisfy lint checks. It adds one blank line after a function signature and removes one trailing blank line. There are no code behavior changes, no bug fixes, and no securit…
This change updates two GitHub Actions used in the project's automated lint workflow so they are locked to specific commit hashes instead of floating version tags. A floating tag could be silently repointed to a different, possibly malicio…
CI/CD supply-chain hardeningthird-party action pinning by commit hashprevention of tag-movement attacks
✓ Descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
Why it was queued
documentation-only discount
AI analysis · Informational 15/100
This commit only changes the version of Bitcoin Core used in automated GitHub test workflows from 29 to 30. It does not modify any production code, wallet logic, network handling, or cryptographic operations. There is no security issue visible in the change itself.
docs: add release note for SIMPLE_TAPROOT_FINAL follow-ups
See https://github.com/lightningnetwork/lnd/pull/10763.
85/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides an explanatory body✓ Links an issue, advisory, or supporting reference
Why it was queued
documentation-only discount
AI analysis · Informational 22/100
This commit only adds a release-note entry describing two previously-merged fixes for taproot Lightning channels. It does not change any code. The described fixes correct how a channel-acceptor RPC reports the commitment type for final taproot channels, and prevent an RBF cooperative-close feature from being incorrectly enabled on taproot overlay channels. These are follow-up corrections to earlier production taproot work, not a new security patch in this commit.
Lower-priorityserver: do not auto-enable RBF coop close for overlay channelsby George Tsagkarelis · 6d951548 · Apr 20, 2026 · 1 fileMessage 85 · StrongLow 39Details
Commit message · George Tsagkarelis
server: do not auto-enable RBF coop close for overlay channels
An earlier commit added an auto-enable that forces RbfCoopClose=true whenever either taproot channel flag is set. This breaks taproot-overlay channels, because the RBF coop close state machine in lnwallet/chancloser/rbf_coop_*.go does not integrate the AuxCloser (or any other aux) hook that overlay channels depend on to build aux-aware close transactions. A node that enables --protocol.simple-taproot-overlay-chans ends up with RBF force-on and its overlay channel closes silently fail, leaving the aux closer unable to finalize on-chain.
Narrow the auto-enable so it only fires for TaprootChans (staging / final taproot) and explicitly skips it when TaprootOverlayChans is set. Operators that positively want RBF can still opt in via --protocol.rbf-coop-close; this change only removes the forced path that silently breaks overlay closes.
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 39/100
This commit fixes a configuration bug in the LND Lightning node software. Previously, enabling experimental 'taproot-overlay' channels automatically forced on a related but incompatible 'RBF cooperative close' feature. That combination would silently break channel closings for those overlay channels. The patch narrows the auto-enable so it does not apply when overlay channels are turned on, while users who want RBF can still opt in manually. There is no attacker exploit here; it is a reliability/functional bug fix.
chanacceptor: map SIMPLE_TAPROOT_FINAL in rpc acceptor
The feature-bits-to-lnrpc-enum switch in sendAcceptRequests covered every commitment type the RPC acceptor can be asked about, except the production taproot variant introduced alongside the prod-taproot-chans work. For a channel open using SimpleTaprootChannelsRequiredFinal (with any combination of the scid-alias / zero-conf modifiers), the switch fell through to the default branch, which logs a warning and leaves commitmentType at its zero value -- lnrpc.CommitmentType_UNKNOWN_COMMITMENT_TYPE. External acceptor clients then see UNKNOWN rather than the actual commitment type and either reject or misclassify the channel.
Add the four missing cases so the new commitment type is reported to acceptor clients correctly.
73/100 · AdequateMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
AI analysis · Low 47/100
This commit fixes a bug in LND's channel-acceptor RPC where a newly added taproot channel type was not being translated into the external protocol enum. External channel-acceptor clients would receive an 'UNKNOWN' commitment type instead of the real one, which could cause them to reject or mislabel taproot channel opens. It is a correctness/availability fix for a protocol-mapping gap, not a cryptographic vulnerability or direct funds-loss bug.
✓ Descriptive subject✓ Uses a recognizable type or scope! No meaningful explanatory body
Why it was queued
documentation-only discount
AI analysis · Informational 15/100
This commit simply adds names to the list of contributors in the release notes for an upcoming version. It changes only documentation text and has no effect on the software's behavior or security.
docs: add new contributors section to contribution guidelines
Advise new contributors to build a PR review track record before submitting code, or to open a detailed issue when they spot a bug.
85/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context
Why it was queued
documentation-only discount
AI analysis · Informational 15/100
This commit only updates the project's written guidelines for new contributors. It adds a section explaining that first-time contributors are encouraged to start by reviewing issues and other people's pull requests rather than submitting new code, partly because AI-generated code submissions have become common. There is no software code change and no security fix or vulnerability introduced.
Lower-prioritydocs: add release note for same-peer onion message cycle dropby Gijs van Dam · 84ec3cb2 · Apr 17, 2026 · 1 fileMessage 93 · StrongLow 37Details
Commit message · Gijs van Dam
docs: add release note for same-peer onion message cycle drop
Record the onion-message same-peer cycle drop from #10754 under a new Robustness subsection in the 0.21.0 release notes.
93/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
Why it was queued
documentation-only discount
AI analysis · Low 37/100
This commit only updates the release notes to describe a fix made in a separate pull request. The actual code change (in PR #10754) prevents a type of network message from being bounced back to the sender, which could otherwise be abused to amplify traffic. The commit itself is documentation-only, so it does not change any running code.
Lower-priorityonionmessage: drop onion messages cycling back to the sending peerby Gijs van Dam · 261babcf · Apr 17, 2026 · 3 filesMessage 73 · AdequateModerate 65Details
Commit message · Gijs van Dam
onionmessage: drop onion messages cycling back to the sending peer
Block forwarding of an onion message when the resolved next hop is the same peer that delivered it. Such a forward would immediately bounce the message back over the very connection it arrived on, which is never useful and can be abused to amplify traffic against a peer.
The check runs after the routing action is resolved, so both direct next-node-ID and SCID-resolved paths are covered. A new `ErrSamePeerCycle` is returned (and logged at warn level) when a cycle is detected.
73/100 · AdequateMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
AI analysis · Moderate 65/100
This update fixes a way that a malicious or misconfigured peer could make a Lightning node repeatedly bounce onion messages back to itself, wasting bandwidth and CPU. The node now detects when the next hop of an onion message is the same peer that sent it and drops the message instead of forwarding it.
peer: enforce onion message rate limits at ingress
This commit plumbs the combined IngressLimiter (per-peer + global) through peer.Config and consults it from the readHandler's *lnwire.OnionMessage case. The decision is factored into a small allowOnionMessage helper so that the ingress policy is directly unit-testable without standing up a full Brontide harness. Per-peer is checked first inside the IngressLimiter: if we consulted the global limiter first, a peer whose own bucket was already empty would still get to burn a global token on each attempt, letting a single hostile peer drain the shared budget and starve legitimate peers.
peer.Config carries a single OnionLimiter field of IngressLimiter type; the brontide readHandler calls a single AllowN per incoming onion message and dispatches on sentinel errors via errors.Is for the first-drop log path. Nil limiter values are treated as "disabled" throughout, which both preserves the pre-change behavior when onion messaging is entirely turned off and keeps the brontide test harness from needing to construct real limiters. Per-peer bucket state is retained across disconnect at the IngressLimiter layer so a peer cannot cycle the connection to reset its per-peer allowance.
OnionMessage also gains a WireSize method that computes the on-the-wire size directly from the in-memory fields (no round-trip through Encode) so the hot ingress path can charge the right number of byte tokens without paying for a full serialization.
The accompanying unit tests cover the nil/disabled path, the per-peer-rejects-first ordering invariant (asserting the global limiter is not consulted when the per-peer bucket is empty), the global rejection path, per-peer isolation across distinct pubkeys, and a small concurrent stress test that asserts every attempt is accounted for as either accepted or dropped and that the total accepted count equals the configured burst under -race. A property-based rapid test on WireSize guards against silent divergence from WriteMessage if the OnionMessage wire format ever gains a TLV extension.
95/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
AI analysis · Moderate 52/100
This commit adds rate limiting for incoming onion messages in the LND Lightning node. Before this change, a single peer could potentially flood the node with onion messages, consuming shared resources and possibly disrupting service for others. The fix enforces per-peer and global byte-based limits before processing each onion message, and keeps per-peer limits even if the peer reconnects. It is a hardening change rather than a fix for a known active exploit.
In this commit we surface the onion message rate limiter thresholds as ProtocolOptions so that operators can tune them from lnd.conf or the command line. Four options are added — onion-msg-peer-rate, onion-msg-peer-burst, onion-msg-global-rate, and onion-msg-global-burst — and are documented such that a rate of zero disables the corresponding limiter entirely. The default values are seeded from the constants added in the previous commit via DefaultConfig, following the same pattern that the Gossip sub-config already uses for its own rate limiter knobs.
The fields are duplicated into protocol_integration.go so that the integration build tag sees the same surface; this mirrors how the existing NoOnionMessagesOption and related fields are declared.
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
parser or protocol pathsecond-pass: security-sensitive path
AI analysis · Informational 12/100
This commit adds user-facing configuration options for rate-limiting onion messages in LND. It does not change any runtime behavior by itself; it only exposes knobs that operators can tune and adds startup validation to catch configuration mistakes. There is no vulnerability introduced or fixed in this diff.
docs: add release note for onion message rate limiting (#10713)
Add a single consolidated release note describing the onion-message rate-limiting feature introduced earlier in this branch: the per-peer and global byte-denominated token-bucket limiters, their defaults and the four tunable flags, the 0/0 disable rule and the startup-time rejection of invalid combinations, the channel-presence gate that drops ingress from peers with no fully open channel, and the protocol.onion-msg-relay-all opt-out for operators who want to accept traffic from channel-less peers. Trimmed to the operator-facing essentials; longer-form prose about the adversary model, the layers, default sizing, and operator recipes lives in docs/onion_message_rate_limiting.md, which the note links to.
93/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
Why it was queued
documentation-only discount
AI analysis · Informational 15/100
This commit only adds documentation to the release notes. It describes an onion-message rate-limiting feature that was already implemented earlier in the same development branch. There are no code changes, no bug fixes, and no security patches in this commit itself.
lncfg+peer+server: add protocol.onion-msg-relay-all to bypass channel gate
Add a new protocol option, protocol.onion-msg-relay-all, that controls whether incoming onion messages are required to come from peers with a fully open channel. The default is false, which preserves the existing behavior: the channel-presence gate drops messages from peers with no channel before the rate limiters are consulted, so a new no-cost identity cannot burn any per-peer byte budget and saturate the global bucket. Setting the flag to true skips the gate so that onion messages from any peer are admitted into the per-peer + global IngressLimiter pipeline.
The flag is plumbed through ProtocolOptions in both the default and integration build variants of lncfg/protocol*.go, threaded into the peer subsystem as peer.Config.OnionRelayAll, and wired by the server from s.cfg.ProtocolOptions.OnionMsgRelayAll alongside the existing OnionLimiter field. allowOnionMessage gains a relayAll bool parameter; the gate check becomes "if \!relayAll && \!hasChannel { drop }" so the semantics of hasChannel stay pure — it still means "this peer has a channel" — and the policy toggle lives entirely in the caller's configuration rather than being spread across gate-state and flag state.
sample-lnd.conf gains a commented-out entry for the new option with the default value and an operator-facing note that enabling it trades the Sybil-resistance property of the gate for reachability to peers with whom we have no channel.
A new TestAllowOnionMessageRelayAll unit test exercises the four (hasChannel, relayAll) combinations at the helper level, including the key new behavior — a peer with hasChannel=false being rejected under relayAll=false and admitted into the limiter under relayAll=true — and the nil-limiter path under relayAll=true, which must still accept. The existing allowOnionMessage tests were extended with the new parameter set to false so they continue to assert the gate semantics unchanged.
95/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
Why it was queued
parser or protocol pathsecond-pass: security-sensitive path
AI analysis · Informational 15/100
This commit adds a new optional configuration flag, protocol.onion-msg-relay-all, that lets a node operator choose whether to accept onion messages only from peers that already have a payment channel (the default, safer behavior) or from any peer. It does not change the default behavior and does not fix a vulnerability; it is a feature addition that preserves the existing security gate unless explicitly disabled.
server+docs: construct onion message rate limiters and document config
With the limiter primitives, config options, and peer-side enforcement in place, this commit constructs the per-peer and global onion message rate limiters inside the server's onion messaging setup block, composes them with NewIngressLimiter, and threads the resulting IngressLimiter into peer.Config alongside the existing SpawnOnionActor factory as a single OnionLimiter field. The limiters are only built when onion messaging is actually enabled so that the disabled path allocates nothing.
sample-lnd.conf gains commented-out entries for the four new options with the default values and a short explanation of the ~5 Mbps worst-case target. The user-facing release note for this feature is added in a single consolidated commit at the end of the series rather than split across the commits that introduce it.
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 15/100
This commit is a straightforward feature-completion patch: it wires up newly added onion-message rate-limiting code, documents the new configuration options in the sample config file, and passes the limiter into peer setup. There is no bug fix, no security vulnerability being patched, and no indication of an active attack or prior weakness. It is a defensive resource-control feature being enabled, not a response to a disclosed incident.
Security candidatepeer: gate onion message ingress on having an open channelby Olaoluwa Osuntokun · c0827e8e · Apr 15, 2026 · 9 filesMessage 95 · StrongHigh 76Details
Commit message · Olaoluwa Osuntokun
peer: gate onion message ingress on having an open channel
Onion message forwarding is an unpaid side channel. Without any peer qualification the byte-bucket limiters added in the previous commits are our only defense against a Sybil attacker: an attacker that can cheaply spin up N identities and burn a full per-peer byte budget on each one saturates the global bucket and converts the aggregate cap into a service-denial primitive against legitimate channel peers. This was raised on PR review — the per-peer cap is good, but the global cap on its own is a Sybil multiplier if peer identity is free. The proper fix is to make new identities cost real capital, which is what requiring a funded channel does.
This commit adds a channel-presence gate as the first check in allowOnionMessage, ahead of both the per-peer and the global rate limiters. Messages from peers that do not have at least one fully open channel with us are dropped with a new dropReasonNoChannel sentinel and never allocate any rate limiter state — the gate runs before either limiter is consulted, so no-channel peers cannot burn tokens on any bucket. Pending channels are deliberately excluded from the check: they are represented as nil values in the activeChannels map, are cheap to open and prone to getting stuck, and so do not provide the capital-cost guarantee the Sybil defense depends on. Existing Brontide cleanup paths (StopOnionActorIfExists, OnionPeerLimiter.Forget) already handle teardown on peer disconnect; nothing new is needed there because the gate keeps no-channel peers from ever allocating per-peer state in the first place.
For the hot path we cannot afford to iterate the activeChannels registry on every incoming onion message, so Brontide now carries a numActiveChans atomic.Int32 that shadows the count of non-pending entries in activeChannels. hasActiveChannels is a single atomic Load and is therefore O(1). The counter is maintained in lockstep with activeChannels at every mutation site: loadActiveChannels increments it as it populates the registry during Start(); addActiveChannel uses a new lnutils.SyncMap.Swap method (a thin typed wrapper around sync.Map.Swap) to atomically replace any prior entry so that both brand-new channels and pending-to-active promotions bump the counter by exactly one; WipeChannel and handleRemovePendingChannel both use LoadAndDelete so they can inspect the prior value and only decrement when the removed entry was non-nil. Under race, this keeps the counter and the map consistent even when RPC WipeChannel races with the channelManager goroutine.
The accompanying unit tests cover: the no-channel drop path at the allowOnionMessage level, asserting that neither the global stub counter nor the per-peer limiter's dropped counter move when the gate fires; the subsequent channel-gained path on the same peer, asserting the same message is accepted once hasChannel flips; and a focused Brontide-level test that walks the counter through initial emptiness, a pending-only state (counter must stay at zero), a pending-to-active promotion via direct Store + Add, the pending delete path through handleRemovePendingChannel (must not underflow), and the active delete path through LoadAndDelete + Add(-1) that WipeChannel uses internally. Running with -race confirms the Swap/LoadAndDelete patterns keep the counter and the map in sync under concurrent access.
95/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
This change closes a denial-of-service weakness in LND's onion-message forwarding. Previously, an attacker could create unlimited free peer identities and burn through the global byte-budget reserved for onion messages, starving real peers. The patch now requires a peer to share at least one funded, fully open Lightning channel before any onion message is accepted, so each attacker identity must lock up real bitcoin. It also adds a fast O(1) atomic counter so this check does not slow down every incoming message.
Introduce docs/onion_message_rate_limiting.md, a prose explainer for operators and contributors that covers the two-layer defense on the onion message ingress path: the channel-presence gate that turns peer identity into a capital cost, and the byte-denominated per-peer and global token-bucket rate limiters that run behind it. The doc walks through the adversary first so that each layer has a concrete thing to defend against, then covers the knobs, the startup-time validation rules, the default sizing, and the protocol.onion-msg-relay-all escape hatch with its explicit tradeoff against Sybil resistance. A short operator recipes section collects the common "I want to ..." configurations so readers do not have to reconstruct them from the principles.
No code change; documentation only.
92/100 · StrongMessage clarity
✓ Descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Explains rationale or failure mode
Why it was queued
documentation-only discount
AI analysis · Informational 15/100
This commit only adds a new documentation file explaining how LND already limits forwarded onion messages to prevent spam and abuse. No code was changed, so it cannot introduce or fix a security bug by itself. It is a prose guide for node operators and developers describing existing defenses.
The existing per-peer actor mailbox (capacity 50, RED from depth 40) only bounds in-flight queue depth. It does not cap throughput: a peer that drains its actor quickly can saturate our Sphinx unwrap CPU, replay-DB writes, and outbound forwarding bandwidth without ever tripping RED. At spec-max onion message sizes (~32 KiB per sphinx packet) a single well-behaved-draining peer is enough to push multiple Mbps of unpaid forwarded traffic through us, and aggregate fan-in from many peers multiplies that into tens of Mbps — an amount of bandwidth that is very much out of proportion for a side channel on a payment routing node.
This commit adds the building blocks for two token-bucket limiters that will be wired into the onion message ingress path in a follow-up commit: a process-wide global limiter and a per-peer registry. Both drop (rather than wait) on over-limit so that a hostile peer cannot grow our goroutine or memory footprint simply by sustaining above-threshold traffic. The per-peer registry keys buckets on the peer's compressed pubkey, creates them lazily, and retains them for the lifetime of the process so a peer cannot reset its burst by cycling the connection; cardinality is bounded by the live channel-peer count (the ingress call site gates on having a channel before allocating per-peer state), so no time-based GC is needed.
A minimal RateLimiter interface is introduced so that callers and tests can substitute noop or alternate implementations without reaching into x/time/rate directly, and a small countingLimiter wrapper keeps an atomic drop counter plus a one-shot first-drop flag for observability. A rate of zero (or a non-positive burst) yields a noop limiter, providing a clean "disabled" mode without branching at the call site.
On top of those, a single IngressLimiter interface composes the per-peer and global buckets behind one surface so that callers — notably the peer readHandler — only thread one object through Config and call one method per incoming onion message. Drop reasons are surfaced as sentinel errors (ErrPeerRateLimit, ErrGlobalRateLimit) wrapped in fn.Result[fn.Unit] so callers match on them with errors.Is rather than comparing free-form strings. The stock implementation encodes the load-bearing ordering — per-peer first, then global — inside AllowN so that a hostile peer whose own bucket is already empty cannot burn global tokens on every rejected attempt and starve legitimate peers.
Default constants targeting roughly ~5 Mbps worst-case ingress at spec-max message sizes are added alongside the existing mailbox defaults.
95/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
Why it was queued
secure hardware boundary
AI analysis · Moderate 61/100
This commit adds new rate-limiting building blocks for LND's onion message handling. It does not yet wire them into live message processing, so by itself it cannot stop an attack. The code is clearly preparing to fix a denial-of-service risk: a single peer (or many peers together) could currently flood a routing node with large, unpaid onion messages and consume CPU, database writes, and outbound bandwidth. The new primitives cap per-peer and total incoming onion-message bytes using token buckets, and they drop excess traffic immediately rather than queuing it.
`testRelayingBlindedError` already uses `flakePaymentStreamReturnEarly` after draining Carol's outgoing liquidity for the same reason: `drainCarolLiquidity` causes the draining node to originate a payment, which produces SEND-type HTLC notifier events. Because `SendPaymentV2` returns SUCCEEDED before the commitment dance (revoke-and-ack exchange) completes, those events can still be in-flight when the test subscribes to HTLC events. The htlc notifier's subscribe server races a pending SendUpdate against the Subscribe call in a single handler goroutine; if registration wins the random select, the stale SEND events land on the new subscriber and corrupt the subsequent FORWARD-type assertion.
`testIntroductionNodeError` has the same pattern — Bob drains Carol's incoming liquidity by originating a payment — but was missing the sleep. Add `flakePaymentStreamReturnEarly()` to match the existing workaround.
✓ 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✓ Names security-relevant behavior explicitly
AI analysis · Informational 15/100
This is a test-only change that adds a short sleep to an integration test to avoid a race condition between payment completion and event subscription. It does not change production code or affect real users' funds, channels, or node security.
funding/test: add test for inline channel_ready processing
In this commit, we add TestChannelReadyUnknownChannelID which verifies that channel_ready messages with unrecognized ChannelIDs are processed inline in the reservation coordinator without spawning goroutines. The test sends 100 channel_ready messages with random ChannelIDs, waits for all of them to be consumed (verified via a FindChannel call counter), then asserts that the goroutine count hasn't grown proportionally. It also confirms the coordinator remains responsive by successfully opening a new channel after the batch completes.
88/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification✓ Names security-relevant behavior explicitly
AI analysis · Informational 12/100
This commit only adds a new automated test to the codebase. It does not change any production logic, fix a bug, or alter how the software handles network messages. The test checks that the funding manager can handle many unexpected 'channel ready' messages without getting stuck or using too many goroutines. Because it is purely a test addition, there is no direct security vulnerability or patch here.
Lower-priorityfunding: process channel_ready messages inline in the coordinatorby Olaoluwa Osuntokun · 312dda86 · Apr 13, 2026 · 1 fileMessage 85 · StrongInformational 24Details
Commit message · Olaoluwa Osuntokun
funding: process channel_ready messages inline in the coordinator
In this commit, we refactor how the funding manager handles incoming channel_ready messages. Previously, every channel_ready message would unconditionally spawn a new goroutine via `go f.handleChannelReady(...)`, making it the only message type in the coordinator switch that wasn't processed inline. We now handle channel_ready the same way as all the other funding messages: synchronously within the reservation coordinator loop.
The goroutine was originally needed because handleChannelReady may need to block on a `localDiscoverySignal` while the channel's funding confirmation flow completes locally. In this commit, we split the function into two parts: `handleChannelReady` (the lightweight entry point that runs inline) and `processChannelReady` (the extracted body that does the actual DB lookup and channel finalization). The inline entry point checks whether a `localDiscoverySignal` exists for the given channel ID, and only in that case do we dispatch a goroutine to wait for the signal before calling `processChannelReady`. For channels that have already confirmed (or after a restart), no goroutine is spawned at all.
This short-circuits the common path: the `FindChannel` DB lookup and the rest of the processing now happen inline in the coordinator for the majority of channel_ready messages, reducing goroutine churn and keeping the coordinator's message processing consistent across all message types.
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 24/100
This commit refactors how LND handles a specific channel-funding message (channel_ready). Previously, every such message launched a new goroutine; now most are processed inline in the main coordinator loop, with goroutines only used when actually waiting for a local funding confirmation signal or doing heavy finalization work. The change is described by the authors as a performance and consistency improvement, not a security fix. There is no direct evidence in the commit or supplied references that this patch addresses a known vulnerability or attack.
AI review queuedmulti: add SCB restore support for production taproot channelsby Olaoluwa Osuntokun · 85bba2ca · Apr 13, 2026 · 3 filesMessage 95 · StrongModerate 63Details
Commit message · Olaoluwa Osuntokun
multi: add SCB restore support for production taproot channels
Add the missing SimpleTaprootFinalVersion case to chanrestore.openChannelShell() so that SCB backups created for production taproot channels can be properly restored. Without this, the channel type bits were not reconstructed during restore, causing DLP to fail.
Also add integration tests for both confirmed and zero-conf variants of production taproot channel backup restoration.
95/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
Why it was queued
signing or wallet pathsecond-pass: security-sensitive path
AI analysis · Moderate 63/100
This commit fixes a bug in LND where backups of a new type of Bitcoin Lightning channel (called a 'production taproot channel') could not be properly restored. Without the fix, the channel type information was lost during restore, which could prevent users from recovering their funds through the Data Loss Protection (DLP) protocol. The commit also adds integration tests for both confirmed and unconfirmed (zero-conf) versions of these channels, and updates a warning comment about a test-only randomness option to make clear it must never be used in production because it could leak private keys.
lnwallet: regenerate taproot test vectors with secret nonces
Regenerate the test vectors JSON to include local_sec_nonce and remote_sec_nonce fields alongside the existing public nonces. The local nonce fields now correctly correspond to local's verification nonce for their own commitment transaction, matching the commitment tx stored in the test vector.
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
defensive validationfuzzing or regression evidencenonce handlingsigning or wallet path
AI analysis · Informational 12/100
This commit only updates test data in a JSON file used for automated tests of Lightning's new taproot channel features. It adds secret nonce values and corrects public nonce values so the test vectors match the expected commitment transactions. There is no change to production wallet or network code, so it does not introduce a security vulnerability or fix one in running software.
Lower-prioritymulti: fix lint and itest failures for production taproot channelsby Olaoluwa Osuntokun · fd3b6386 · Apr 13, 2026 · 2 filesMessage 83 · StrongInformational 14Details
Commit message · Olaoluwa Osuntokun
multi: fix lint and itest failures for production taproot channels
Fix line length lint violations in utxonursery.go by adding nolint:ll directives to long case statements for production taproot witness types.
Fix itest funding negotiation test to handle SIMPLE_TAPROOT_FINAL in the taproot negotiation failure check. Previously the test only expected failure when Carol wanted SIMPLE_TAPROOT and Dave lacked taproot support, but did not handle the symmetric case where Carol wants SIMPLE_TAPROOT_FINAL.
83/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Mentions testing or verification
AI analysis · Informational 14/100
This commit is a routine cleanup patch. It adds linter-suppression comments to silence line-length warnings and updates an integration test to cover both variants of a new taproot channel type. There is no change to production behavior or security logic.
chanbackup: add SimpleTaprootFinalVersion for production taproot backups
Add a dedicated backup version (7) for production taproot channels that use final scripts with OP_CHECKSIGVERIFY. This distinguishes them from staging taproot channels in the SCB format, ensuring backup compatibility is explicit about the channel type.
73/100 · AdequateMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
AI analysis · Informational 19/100
This commit adds a new backup version number (7) for a specific type of taproot Lightning channel. It is a compatibility and labeling change in how channel backups are created and recognized, not a fix for an active security flaw. There is no evidence in the commit of a vulnerability being exploited or of malicious behavior.
AI review queuedwatchtower: add production taproot channel support to justice kitby Olaoluwa Osuntokun · 7a18fba6 · Apr 13, 2026 · 10 filesMessage 73 · AdequateModerate 54Details
Commit message · Olaoluwa Osuntokun
watchtower: add production taproot channel support to justice kit
Wire channel type through BreachRetribution and the watchtower blob system to support production taproot channels with final scripts.
The key changes are:
1. Add ChanType field to BreachRetribution so downstream consumers (including the watchtower) can determine the script variant.
2. Add FlagTaprootFinalChannel blob type flag and TypeAltruistTaprootFinalCommit blob type to distinguish production from staging taproot channels in watchtower backups.
3. Add TaprootFinalCommitment to the watchtower's CommitmentType enum with appropriate witness type and size mappings.
4. Update taprootJusticeKit to use WithProdScripts() when constructing script trees for production taproot channels. The isFinal flag is set during construction from BreachRetribution.ChanType and during deserialization from the blob's commitment type.
Without this change, the watchtower would construct justice transactions using staging scripts for production taproot channels, resulting in invalid witnesses that fail to sweep breached outputs.
73/100 · AdequateMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
Why it was queued
signing or wallet pathsecond-pass: broader security terminologysecond-pass: security-sensitive path
AI analysis · Moderate 54/100
This commit fixes a bug in LND's watchtower (a service that helps recover funds if a channel partner tries to cheat) so it correctly handles production taproot channels. Before this fix, the watchtower would use the wrong script variant when building recovery transactions, producing invalid transactions that could not actually sweep the breached funds. The change wires the channel type through several internal data structures and adds a new blob type for final/production taproot channels. A small related change also makes the RBF cooperative close protocol use the current block height instead of a fixed height at startup, and forces RBF cooperative close to be enabled whenever taproot channels are enabled.
AI review queuedcmd/commands: add taproot-final to lncli open commandby Olaoluwa Osuntokun · 29de2c86 · Apr 13, 2026 · 5 filesMessage 50 · ThinInformational 17Details
Commit message · Olaoluwa Osuntokun
cmd/commands: add taproot-final to lncli open command
50/100 · ThinMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component! No meaningful explanatory body
Why it was queued
signing or wallet pathsecond-pass: security-sensitive path
AI analysis · Informational 17/100
This commit adds a new command-line option called 'taproot-final' for opening Lightning channels. It is a feature addition that exposes an already-existing protocol commitment type through the lncli user interface. There is no indication in the commit that it fixes a security bug or vulnerability.