Channel type downgrade attempted on non-type-related peer errors
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:**
1. Open anchor channel to a peer requiring 400k sat minimum, sending 100k
2. Peer rejects: `"invalid funding_amount=100000 sat (min=400000 sat)"`
3. LDK downgrades to static_remote_key and retries
4. 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`.
0 条评论