Skip to content

Client trusts lsp #572

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
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

martinsaposnic
Copy link

@martinsaposnic martinsaposnic commented Jun 9, 2025

Please just review the second commit 53a8174. The first commit is just compatibility changes so it works with rust-lightning

This PR uses the functionality introduced in this other PR lightningdevkit/rust-lightning#3838, and creates 2 tests that demonstrates the feature

Changes:

  • call store_funding_transaction when funding transaction is created
  • call channel_needs_manual_broadcast to check if it needs to call funding_transaction_generated_manual_broadcast or funding_transaction_generated
  • call lsps2_funding_tx_broadcast_safe when FundingTxBroadcastSafe is emitted
  • a refactor on PaymentClaimable so it does not autoclaim (this will be changed in a future commit)
  • a new fn receive_via_jit_channel_manual_claim so the client can actually do a manual claim with claim_for_hash, instead of auto claiming
  • two beautiful tests that check the functionality
    • lsps2_client_trusts_lsp checks that the funding_tx is not broadcasted until the htlc is claimed
    • lsps2_lsp_trusts_client_but_client_does_not_claim checks that the funding_tx is broadcasted even though the client didn't claim the htlc

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Jun 9, 2025

🎉 This PR is now ready for review!
Please choose at least one reviewer by assigning them on the right bar.
If no reviewers are assigned within 10 minutes, I'll automatically assign one.
Once the first reviewer has submitted a review, a second will be assigned if required.

@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

src/event.rs Outdated
"Failed to process funding transaction: {:?}",
err
self.liquidity_source.as_ref().map(|ls| {
ls.lsps2_store_funding_transaction(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we always need to store the funding transaction, even if we're not doing the full flow?

Copy link
Author

@martinsaposnic martinsaposnic Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved it to inside the if statement, so it will store it only if needs_manual_broadcast is true 👍

src/event.rs Outdated
return Err(ReplayEvent());
},
};
self.payment_store.update(&update).map_err(|e| {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a lot of unrelated changes happening in this commit. a) not sure if I agree that they are worth doing at all but b) always try to keep such changes in separate commits please.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that, I made a rebase and a cleanup. now this commit 53a8174 will have the minimal changes to make the client_trusts_lsp flow work

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a lot of unrelated changes happening in this commit.

This was a refactor on the PaymentClaimable event to make the manual claim work on my tests.

That part is removed after the rebase, so we should be good now

@martinsaposnic martinsaposnic requested a review from tnull June 16, 2025 19:49
@martinsaposnic martinsaposnic marked this pull request as ready for review June 17, 2025 14:29
@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot
Copy link

🔔 2nd Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot
Copy link

🔔 3rd Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants