Closed aakselrod closed 1 week ago
[!IMPORTANT]
Review skipped
Auto reviews are limited to specific labels.
Labels to auto review (1)
* llm-reviewPlease check the settings in the CodeRabbit UI or the
.coderabbit.yaml
file in this repository. To trigger a single review, invoke the@coderabbitai review
command.You can disable this status message by setting the
reviews.review_status
tofalse
in the CodeRabbit configuration file.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Closing in favor of just using RBF co-op close when available.
Change Description
This PR changes
CreateCooperativeCloseTx
to only include a balance output if the output is strictly greater than the dust limit. This matches the behavior ofLocalBalanceDust
andRemoteBalanceDust
, which mark a balance output as dust if it's less than or equal to the dust limit.Without this change,
CreateCooperativeCloseTx
includes the balance output when it's greater than or equal to the dust limit. When the balance of the channel responder is exactly the dust limit in a tweakless channel, the transaction includes the output but not the fee for the output, determined by the channel closer ininitFeeBaseline
here.When deciding whether to change
CreateCooperativeCloseTx
or(Local|Remote)BalanceDust
, I checked how LDK implements this because this caused a force-close when attempting a co-op close from LND of a channel with LDK. LDK omits the output when it's less than or equal to the dust limit, similar to(Local|Remote)BalanceDust
, and does not accept a co-op close transaction with the output included.Steps to Test
There are a couple of ways I can add a test. The easier way is to directly test for inclusion/exclusion of an output that's exactly the dust amount when calling this function.
A more interesting way would be to create a channel, set the balance on one side to dust, use a
ChanCloser
to create a close TX, and ensure that the fee rate, total fee, and weight of the transaction match, though it's more involved in terms of setup to provide access to bothlnwallet
internals andChanCloser
without import cycles.Pull Request Checklist
Testing
Code Style and Documentation
[skip ci]
in the commit message for small changes.📝 Please see our Contribution Guidelines for further guidance.