Repository navigation
Add Node::splice_out_max - #1181
Conversation
|
👋 Thanks for assigning @jkczyz as a reviewer! |
|
A heads up this currently conflicts with #1176 |
| return Err(Error::ChannelSplicingFailed); | ||
| }; | ||
|
|
||
| // TODO: Retain maximum-withdrawal intent across restarts so its output can shrink |
There was a problem hiding this comment.
The docs cover that a bump here may be funded by the on-chain wallet, but that fallback doesn't hold back the anchor reserve: select_confirmed_utxos has no reserve logic, and bump_channel_funding_fee doesn't check funds.
Since a max withdrawal leaves no channel balance for a higher fee, almost any bump (unless the channel balance has grown since) pays the whole output plus fees from the wallet, and can spend the reserve. A plain splice_out can hit this too, but here it's the expected path.
Maybe refuse the wallet fallback for these until the TODO is done, or check the reserve first? Related: #1166.
There was a problem hiding this comment.
I suggest we fix issue 1166 for both splice_out and splice_out_with_all in a separate PR.
Maybe refuse the wallet fallback for these until the TODO is done
This would require persisting the intention to withdraw the maximum from the channel instead of funding a destination address with a fixed amount. I think this should be done as part of a PR to shrink the size of the output instead of increasing the value of the inputs.
cb33776 to
2a7d714
Compare
splice_out refused any amount above the channel's outbound capacity. That capacity is computed against the current channel reserve, but a splice-out shrinks the channel and with it the reserve, so LDK can accept a larger splice-out than the guard allowed. Compare against LDK's next_splice_out_maximum_sat instead, which accounts for the reduced reserve, so the guard only rejects amounts LDK would refuse. Suggested by tankyleo in lightningdevkit#1103. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2a7d714 to
f9ef993
Compare
| /// This API is experimental. Currently, a splice-out will be marked as an inbound payment if | ||
| /// paid to an address associated with the on-chain wallet, but this classification may change | ||
| /// in the future. | ||
| pub fn splice_out_with_all( |
There was a problem hiding this comment.
Should we rename this splice_out_max? The _with_all suffix refers to using all inputs when splicing in. But here we are withdrawing the maximum amount from the channel, which isn't the entire balance.
| // TODO: Retain maximum-withdrawal intent across restarts so its output can shrink | ||
| // to cover higher fees while preserving the channel debit. |
There was a problem hiding this comment.
IIUC, this should be done upstream instead of having an intent. If so, could you open an issue upstream with the approach mentioned offline?
There was a problem hiding this comment.
Issue filed here: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/issues/5305
| do_splice_out_with_all(true, Some(FeeRate::from_sat_per_kwu(2_500))).await; | ||
| } | ||
|
|
||
| async fn do_splice_out_with_all(is_funder: bool, fee_rate: Option<FeeRate>) { |
There was a problem hiding this comment.
Should we test RBF behavior here?
There was a problem hiding this comment.
I had codex do a concise expansion to test RBF behavior below. As described it currently is not what the user expects: we keep the destination output the same value, and shift to using wallet inputs to fund the higher fee.
jkczyz
left a comment
There was a problem hiding this comment.
LGTM. Please squash fixups.
05b0ce8 to
431a376
Compare
In case a user wants to withdraw on-chain the maximum amount possible from a channel, the sum of the value of the spliced output and the fees they contribute to the splice has to be equal to `ChannelDetails::next_splice_out_maximum_sat`. It is currently not ergonomic to express this via the current `Node::splice_out` API, so we add `Node::splice_out_max` to satisfy this gap. This API remains unfinished; we would like any fee bumps of such splices to decrease the value of the spliced output instead of increasing the total value of the inputs of the splice transaction. Co-Authored-By: HAL 9000
431a376 to
af0f5e1
Compare
|
squashed with edits to the tests, documentation, and changelog. |
|
Use |
Uh oh!
There was an error while loading. Please reload this page.