Commit message · auto-pr-botIgnore push_msat balances on closed unfunded inbound channels
As reported by Anthropic's OSS Scanner (ANT-2026-03R3IMY1), as quoted in
the issue by @tnull:
> A peer with no channel to an LDK node, spending nothing on-chain, can
> make the node keep an unbounded number of `ChannelMonitor`s that are
> never archived. It does this by repeatedly opening an inbound V1
> channel with `push_msat` at or above the node's 354 sat dust limit,
> sending `funding_created`, never broadcasting the funding transaction,
> and closing with `error`. Each leaked monitor is about 6.8 KB. It is
> persisted, held in memory, reloaded at start-up, rewritten in full
> through `Persist::update_persisted_channel` on every block, and raises
> a `BumpTransaction::ChannelClose` event on every block and every
> `rebroadcast_pending_claims` tick. There is no public API to remove
> these monitors. No funds are at risk.
@wpaulino asked:
> @auto-pr-bot open a PR to fix this issue with the suggestion provided.
> Include in the commit message that this was reported by Anthropic's
> OSS Scanner, as ANT-2026-03R3IMY1.
A monitor for an inbound channel closed without any state update whose
funding never appeared is only archived when it reports no claimable
balances. Because the pushed amount shows up as our balance on the
initial holder commitment transaction, a push above our dust limit kept
the monitor alive forever, letting a peer leave behind one monitor per
open/funding_created/error round with no bound.
Extend the condition that omits the primary balance for such monitors to
also cover a non-zero push: for an inbound V1 channel we contributed
nothing, so the only balance is the counterparty's push, which exists
only if they broadcast the funding transaction after we already closed
the channel. Outbound channels (our own funds), dual-funded inbound
channels (we may have contributed inputs), and monitors written before
`funding_seen_onchain` existed (which default it to true on read) are
unaffected. The trade-off, which the earlier fix already contemplated,
is that a push is forfeited if the funding transaction only confirms
after the channel was closed and the monitor was archived; we never held
those funds.
Raise the push in test_channel_conf_timeout above the dust limit so the
test covers the non-zero-balance case; it fails without the fix.
Requested-by: @wpaulino
Authored-By: matt/GLM-5.3-Flash-GGUF:Q4_K_XL <goose@users.noreply.local>
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