Skip to content

Explore whether PaidBolt12Invoice should be moved to PaymentMetadataStore #816

Description

@tnull

In #733 we introduced a bolt12_invoice: Option<PaidBolt12Invoice> field to PaymentSuccessful.

While this works, it's a bit awkward to have a BOLT12-specific field on an event that is also used for other payment means. After #811 and #448 we should reconsider whether we should rather move storing the paid invoice to PaymentMetadata store, which might also allow to avoid the clone-on-persisting for the ffi version of the PaidBolt12Invoice.

Activity

  1. added this to the 0.8 milestone on Mar 4, 2026
  2. f3r10 commented on Mar 19, 2026

    @f3r10
    Contributor

    @tnull could I work on this issue?

    After analyzing this issue, I consider that moving PaidBolt12Invoice into PaymentDetails (specifically into the Bolt12Offer / Bolt12Refund variants of PaymentKind has to be done.

    • I think that PaidBolt12Invoice belongs with durable payment metadata, not a transient event.
    • The PaidBolt12Invoice should be retrievable after the event is consumed
    • get rid of this TODO, which exists because the invoice is embedded in a Clone-required Event variant; moving it to PaymentKind removes that constrain
     src/ffi/types.rs:857–862:
      impl Writeable for PaidBolt12Invoice {
          fn write<W: Writer>(&self, w: &mut W) -> Result<(), lightning::io::Error> {
              // TODO: Find way to avoid cloning invoice data.
              let ldk_type: LdkPaidBolt12Invoice = self.clone().into();
              ldk_type.write(w)
          }
      }
  3. tnull commented on Mar 20, 2026

    @tnull
    CollaboratorAuthor

    @tnull could I work on this issue?

    After analyzing this issue, I consider that moving PaidBolt12Invoice into PaymentDetails (specifically into the Bolt12Offer / Bolt12Refund variants of PaymentKind has to be done.

    • I think that PaidBolt12Invoice belongs with durable payment metadata, not a transient event.
    • The PaidBolt12Invoice should be retrievable after the event is consumed
    • get rid of this TODO, which exists because the invoice is embedded in a Clone-required Event variant; moving it to PaymentKind removes that constrain

    src/ffi/types.rs:857–862:
    impl Writeable for PaidBolt12Invoice {
    fn write<W: Writer>(&self, w: &mut W) -> Result<(), lightning::io::Error> {
    // TODO: Find way to avoid cloning invoice data.
    let ldk_type: LdkPaidBolt12Invoice = self.clone().into();
    ldk_type.write(w)
    }
    }

    No, as mentioned above, if we want to do this, it would be blocked on #811.

  4. f3r10 commented on Mar 20, 2026

    @f3r10
    Contributor

    No, as mentioned above, if we want to do this, it would be blocked on #811.

    Got it. Would look into another issue. If you have any suggestion happy to work on it

  5. tnull commented on Aug 10, 2026

    @tnull
    CollaboratorAuthor

    This will slip to v0.9 due to #425 slipping.

  6. modified the milestones: 0.8, 0.9 on Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions