Skip to content
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

[NUT-15] LND Support for MPP Payments #536

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

lollerfirst
Copy link
Contributor

Description

Query the high probability routes for the public key in the invoice. Attempt the first route: if the failure code is 15 (TEMPORARY_CHANNEL_FAILURE), attempt the next route.


CHANGED

  • pay_invoice: forks execution based on the presence of a partial_amount.

Checklist

..Default::default()
})
.await
.map_err(|_| Error::PaymentFailed)?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wont this return here due to the use of ? so if the payment fails the next route cannot be tried?

Copy link
Contributor Author

@lollerfirst lollerfirst Jan 16, 2025

Choose a reason for hiding this comment

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

I think we only want to try more routes if we get a specific error 15 (TEMPORARY_CHANNEL_FAILURE). If we get any other kind of error then something else is up.

crates/cdk-lnd/src/lib.rs Outdated Show resolved Hide resolved
.map_or(0, |route| route.total_amt_msat / MSAT_IN_SAT as i64)
as u64;
// Detect partial payments
if let Some(part_amt) = partial_amount {
Copy link
Collaborator

Choose a reason for hiding this comment

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

NIT: Since we care about both paths the Some and None we should use a match and not if let to be consistent with code style https://github.com/cashubtc/cdk/blob/main/CODE_STYLE.md#if-let

@thesimplekid thesimplekid added enhancement New feature or request mint labels Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request mint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants