Commit graph

4 commits

Author SHA1 Message Date
Ken Sedgwick
96dbec2d7d
InvoicePayer: migrate pay -> xpay for CLN v26.06 compat
The third v26.06 deprecation hitting CLBOSS.  pay was deprecated
in v26.06 with last supported version v27.03 (tighter than
getroute's v27.06 window) and is replaced by xpay, which has been
available since v24.11 -- so this is a straight migration with no
compat bridge required on any CLN version we care about.

The sole producer of Msg::PayInvoice is SwapManager paying a
Boltz swap-out invoice (Boss/Mod/SwapManager.cpp:541): when
CLBOSS does an off-chain to on-chain swap, Boltz issues a bolt11
invoice for the off-chain side and CLBOSS pays it; Boltz then
sends the equivalent on-chain.

- pay -> xpay
- request field bolt11 -> invstring
- replace maxfeepercent (a percentage) with maxfee (an absolute
  msat amount) computed from the decoded invoice amount; the
  fraction 0.005 preserves the legacy non-MPP 0.5% cap.

xpay's own default maxfee is 1% (5000msat floor), which would
have doubled our historical fee budget on swap-outs.  Because
this code path is exclusively swap-out invoice payment -- real
money on prod -- we set an explicit absolute maxfee instead of
accepting xpay's default.  Worst-case extra fee per swap was
bounded at 0.5% of the swap amount under the default; this
keeps it at the historical 0.5%.

- The MPP feature-bit detection (hex-parsing the bolt11 features
  string and checking bits 16/17) is removed.  Its sole purpose
  was to pick between two maxfeepercent values for pre-xpay pay,
  whose pre-v0.10 MPP fee-budget management was poor and required
  a generous 5% cap to succeed.  xpay's askrene-driven multi-path
  routing manages its own per-part fee budget, so we always pass
  a single absolute maxfee and let xpay split or not as needed.
- The Util::Str::HexParseFailure catch path is removed (no
  longer reachable -- we no longer parse hex features).
- The Util/Str.hpp include is dropped.
- The nonmpp_maxfeepercent and mpp_maxfeepercent constants are
  replaced by a single maxfee_fraction.

- The decode round-trip and validation that the input is a
  valid bolt11 invoice.  Boltz swap-out invoices are always
  bolt11, so this stays useful as a sanity check.  The decode
  is now also used to extract amount_msat for the maxfee
  computation; if the invoice is amountless (which Boltz never
  emits) the parser throws Jsmn::TypeError and the existing
  "Unexpected decode result" log path catches it.
- retry_for = 1000 (matches historical behavior).
- The RpcError / Jsmn::TypeError catching pattern; response
  parsing is unchanged (we still consume the response as
  Jsmn::Object _ without reading fields).
2026-05-22 10:52:08 -07:00
Ken Sedgwick
d23778fc6a
fix: make the argument to decode "string" instead of "bolt11" 2026-02-17 15:49:04 -08:00
Ken Sedgwick
b7251de364
fix: use CLN decode RPC in InvoicePayer, add unit test 2026-02-13 11:40:15 -08:00
ZmnSCPxj jxPCSnmZ
0fdda1aa4d Boss/Mod/InvoicePayer.cpp: Module to pay invoices. 2020-09-28 11:28:07 +08:00