Skip to content

Consider setting min_value_msat in LSPS2's create_inbound_payment #609

Closed

Description

@tnull

While we still make sure to only claim if the withheld amount is what we expect, I think we should be able to set the min_value_msat field on create_inbound_payment to the net amount, which probably would yet another layer of protection?

Activity

  1. Jolah1 commented on Jun 29, 2026

    @Jolah1
    Contributor

    @tnull
    I'd like to pick this up.

    Proposed fix:
    In lsps2_create_jit_invoice (client/lsps2.rs), both create_inbound_payment_for_hash and create_inbound_payment pass None for min_value_msat. I'd set it to the net amount — amount_msat − max_total_opening_fee_msat — so LDK floors what it'll claim, on top of the existing withheld-amount check (using the max total fee gives the lowest acceptable net, the right floor). This only works where the net is deterministic — fixed amount_msat and fixed max_total_opening_fee_msat; for variable-amount or proportional-fee-only quotes I'd leave it None.

    One sequencing question: the BOLT12 receive-through-JIT path in #817 is another inbound-payment site that wants the same floor. Would you rather I (a) do the BOLT11 paths now and follow up on BOLT12 once #817 lands, or (b) wait and cover both in one PR? Either way is fine, depends on your read of #817's timeline.

    And does amount_msat − max_total_opening_fee_msat match the net figure you had in mind?

  2. Jolah1 commented on Aug 3, 2026

    @Jolah1
    Contributor

    Update: #817 has been superseded by #999. I checked the current head, and its BOLT11 LSPS2 invoice registration still passes None for min_value_msat, so this issue remains applicable. Since #999 substantially rewrites this path, I’ll hold off unless you’d prefer this handled on top of #999 or as a follow-up after it lands.

  3. added 2 commits that reference this issue on Oct 12, 2026
    b5c731d
    81eb994
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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions