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

Simplify getting preimage from send_payment result #506

Closed
ok300 opened this issue Oct 6, 2023 · 2 comments
Closed

Simplify getting preimage from send_payment result #506

ok300 opened this issue Oct 6, 2023 · 2 comments
Labels

Comments

@ok300
Copy link
Contributor

ok300 commented Oct 6, 2023

To get to the preimage from the payment result of send_payment, the caller has to match the type of payment.details because the PaymentDetails are an enum:

pub enum PaymentDetails {
    Ln {
        #[serde(flatten)]
        data: LnPaymentDetails,
    },
    ClosedChannel {
        #[serde(flatten)]
        data: ClosedChannelPaymentDetails,
    },
}

However we know this could only have been a LnPaymentDetails.

We should simplify this.

Maybe construct a user-facing struct LnPayment, that is identical to Payment except it maps the details to LnPaymentDetails?

@ok300 ok300 added the sdk-core label Oct 6, 2023
@JssDWt
Copy link
Contributor

JssDWt commented Oct 6, 2023

There is already an issue for this here #302

@ok300
Copy link
Contributor Author

ok300 commented Oct 10, 2023

Duplicate of #302

@ok300 ok300 marked this as a duplicate of #302 Oct 10, 2023
@ok300 ok300 closed this as completed Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants