-
Notifications
You must be signed in to change notification settings - Fork 444
Description
When a peer rejects an outbound channel open with an error unrelated to channel type (e.g. funding amount below their minimum), handle_error still calls maybe_handle_error_without_close, which downgrades channel features and retries. The retry fails for the same reason, wasting a round trip.
Reproduction:
- Open anchor channel to a peer requiring 400k sat minimum, sending 100k
- Peer rejects:
"invalid funding_amount=100000 sat (min=400000 sat)" - LDK downgrades to static_remote_key and retries
- Peer rejects again:
"invalid channel_type=0x1000"
Expected: LDK recognizes funding amount errors are not channel type failures and closes without retry.
Root cause: handle_error() in channelmanager.rs unconditionally attempts channel type downgrade. The error message (msg.data) is available but not inspected.
Proposed fix: Check error message for non-type patterns (funding amount, min channel size, dust limits, reserves) before calling maybe_handle_error_without_close. Draft at FreeOnlineUser/rust-lightning branch fix-channel-type-downgrade-on-unrelated-error.