-
Notifications
You must be signed in to change notification settings - Fork 378
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
Allow for user-specified error message during force close channel #2889
Conversation
Important Auto Review SkippedDraft detected. Please check the settings in the CodeRabbit UI or the To trigger a single review, invoke the 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? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #2889 +/- ##
==========================================
+ Coverage 89.42% 90.21% +0.78%
==========================================
Files 117 118 +1
Lines 96290 104723 +8433
Branches 96290 104723 +8433
==========================================
+ Hits 86109 94475 +8366
- Misses 7962 8097 +135
+ Partials 2219 2151 -68 ☔ View full report in Codecov by Sentry. |
I have updated the PR, Please review. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to squash the fixup commits as you go. Please write a much more detailed commit message describing what was changed and why.
I have updated the above changes in my Pr. |
Gentle reminder for the review. |
If every thing looks good, I will squash it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please proofread your commit before you push, don't rely on reviewers.
Understood, I'll keep in mind in future. |
I have Proofread my commits, and i think it is fulfilling the objectives of issue, if not I'll update the PR accordingly :) |
Basically LGTM! Please squash the commit history so that each commit stands on its own and compiles+passes tests and no later commits are fixing/cleaning up things from previous commits (in this PR I think that probably means just one commit). Also please line-wrap the commit message(s) to 70 chars. Finally, note that your diff has some end-of-line whitespace in a few places. A local |
Ok, |
Please line-wrap your commit message text. |
Is it fine now? |
No? The lines are still longer than 70 chars? |
Done. |
CI thinks there's still places that need updating to the new API (possibly needs rebase), other than that this LGTM. |
d20bb25
to
fd1f2dc
Compare
CI is also done. |
CI is still failing, see the check_commits and fuzz jobs. |
Sorry about that, I missed it. |
In this commit i added additional parameter `error_message` to `force_close_sending_error`. This parameter will allow users to configure error message and send to peers during the force closing of channel.I have also updated the tests for this updated function.
LGTM, but will need to wait for the next release. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test changes could be cleaned up, but its fine enough.
@@ -3592,6 +3593,7 @@ fn do_claim_from_closed_chan(fail_payment: bool) { | |||
// height. | |||
connect_blocks(&nodes[3], final_cltv - HTLC_FAIL_BACK_BUFFER - nodes[3].best_block_info().1 | |||
- if fail_payment { 0 } else { 2 }); | |||
let error_message = "Channel force-closed"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to keep the variable creation close to the place they're used.
@@ -3601,7 +3603,7 @@ fn do_claim_from_closed_chan(fail_payment: bool) { | |||
expect_pending_htlcs_forwardable_and_htlc_handling_failed!(&nodes[3], [reason]); | |||
pass_failed_payment_back(&nodes[0], &[&[&nodes[1], &nodes[3]], &[&nodes[2], &nodes[3]]], false, payment_hash, PaymentFailureReason::RecipientRejected); | |||
} else { | |||
nodes[1].node.force_close_broadcasting_latest_txn(&chan_bd, &nodes[3].node.get_our_node_id()).unwrap(); | |||
nodes[1].node.force_close_broadcasting_latest_txn(&chan_bd, &nodes[3].node.get_our_node_id(), error_message.to_string()).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It woudl be nice to move the .to_string()
to the error_message
declaration, reducing the amount of text on the force_close lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess alternatively, the force_close method could be made to accept &str, or both &str and String?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could, but inside it needs a String
anyway, so we really want that to be the API. Otherwise, eg, the user might do &format!(..)
, resulting in an allocation of a string, then a reference to it passed to LDK, which then unnecessarily clones.
This Pr solves issue #2840