You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider setting min_value_msat in LSPS2's create_inbound_payment #609
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?
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?
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.
Activity
Jolah1 commentedon Jun 29, 2026
@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?
Jolah1 commentedon Aug 3, 2026
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.
Reject underpaid BOLT11 JIT invoices
Reject underpaid BOLT11 JIT invoices