Skip to content

[feature]: add custom chan support to new rbf chan closer #9663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Roasbeef opened this issue Apr 1, 2025 · 6 comments
Open

[feature]: add custom chan support to new rbf chan closer #9663

Roasbeef opened this issue Apr 1, 2025 · 6 comments
Labels
channel closing Related to the closing of channels cooperatively and uncooperatively enhancement Improvements to existing features / behaviour protocol rbf

Comments

@Roasbeef
Copy link
Member

Roasbeef commented Apr 1, 2025

Is your feature request related to a problem? Please describe.

Today the RBF chan closer doesn't observe/propagate the auxOutputs functional option like the legacy closing protocol does:

// Before we complete the cooperative close, we'll see if we
// have any extra aux options.
c.auxOutputs, err = c.auxCloseOutputs(remoteProposedFee)
if err != nil {
return noClosing, err
}
c.auxOutputs.WhenSome(func(outs AuxCloseOutputs) {
closeOpts = append(
closeOpts, lnwallet.WithExtraCloseOutputs(
outs.ExtraCloseOutputs,
),
)
closeOpts = append(
closeOpts, lnwallet.WithCustomCoopSort(
outs.CustomSort,
),
)
})

Describe the solution you'd like

We should update the state transition in the new RBF closer to support this feature (permits > 1 output to the sender on a co-op close transaction).

@Roasbeef Roasbeef added channel closing Related to the closing of channels cooperatively and uncooperatively enhancement Improvements to existing features / behaviour protocol rbf labels Apr 1, 2025
@Lokeshranjan8
Copy link

Hey @Roasbeef, should auxOutputs be applied by default in the new RBF closer, or do we need to check conditions like the remote proposed fee? Also, any potential conflicts with CustomSort?

@Lokeshranjan8
Copy link

Lokeshranjan8 commented Apr 3, 2025

@Roasbeef I'd like to take this up! From what i understand, the goal is to ensure that the new RBF closer properly supports multiple outputs to the sender in a co-op close transaction.

Approch--

  1. I'll start by looking at rbf_coop_transitions.go and related files to see how the transaction is currently structured and where
    auxCloseOutputs needs to be added.

  2. Modify the transaction logic – I’ll update the code to allow multiple outputs for the sender while making sure it doesn’t break
    any existing assumptions in the closing process.

    3)Handle RBF updates – Since the fee can be bumped mid-process, I'll ensure auxCloseOutputs persist correctly when an RBF
    attempt is made.

Let me know if there's anything specific you’d like me to keep in mind before I start:)

@Roasbeef
Copy link
Member Author

Roasbeef commented Apr 4, 2025

@Lokeshranjan8 if you take a look at the existing implementation, the integration with AuxCloser should be pretty much the same.

Thinking about it a bit further, this also needs to carry over the set of extra custom records into the shutdown message.

@Lokeshranjan8
Copy link

Lokeshranjan8 commented Apr 4, 2025

@Lokeshranjan8 if you take a look at the existing implementation, the integration with AuxCloser should be pretty much the same.

Thinking about it a bit further, this also needs to carry over the set of extra custom records into the shutdown message.

Hello,I'm trying to simulate RBF closes in regtest as per the suggestion in this issue.

I'm using the --sat_per_byte flag to initiate a cooperative close with a low fee, then trying to bump it with a higher value. However, I run into this error on the first attempt:

[lncli] rpc error: code = Unknown desc = unable to process close msg: latest fee proposal exceeds max fee: 0.00000602 BTC > 0.00000585 BTC
Then, if I retry with a higher --sat_per_byte, I get:

rpc error: code = Unknown desc = unable to gracefully close channel while peer is offline (try force closing it instead): channel link not found
It seems the channel got closed after the first error, but I didn’t get a chance to test fee bumping (RBF).

Am I missing something in the setup? Is there a specific way to configure regtest to allow proper simulation of RBF fee bumps, or should I be using the new RBF APIs more directly?

Thanks for your help — just want to make sure I’m testing it the right way before working on propagating auxOutputs.

@Roasbeef
Copy link
Member Author

[lncli] rpc error: code = Unknown desc = unable to process close msg: latest fee proposal exceeds max fee: 0.00000602 BTC > 0.00000585 BTC

You need to activate RBF close with: `--protocol:

lnd/sample-lnd.conf

Lines 1417 to 1418 in 867d27d

; Set to disable support for RBF based coop close.
; protocol.rbf-coop-close=false
.

Stepping back for a minute, let's say you have an implementation, do you understand how to test it e2e, and which additional repos would be needed?

@saubyk
Copy link
Collaborator

saubyk commented Apr 10, 2025

@Roasbeef I'd like to take this up!

Hi @Lokeshranjan8 before investing any further time on this issue, please go through the contribution guideline for new contributors...
https://github.com/lightningnetwork/lnd/blob/master/docs/review.md

Please take some time to review other prs before submitting one yourselves. Without any review credits, your prs will languish for review input.

Additionally, please note that this particular issue is intermediate to advanced level complexity. Would recommend taking on a few simpler issues first (look for good first issue or beginner labels) and familiarizing yourselves with LND development and testing before attempting this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
channel closing Related to the closing of channels cooperatively and uncooperatively enhancement Improvements to existing features / behaviour protocol rbf
Projects
None yet
Development

No branches or pull requests

3 participants