xpay: support paying a (simple) bolt12 offer directly.

fetchinvoice is still good for detailed diagnostics and handling
recurring invoices and alternate currencies, but this covers the
"throw some sats" case well.

Changelog-Added: JSON-RPC: `xpay` can now pay a simple offer directly, rather than requiring fetchinvoice first.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2025-08-18 11:00:52 +09:30
parent aea7358976
commit 103a49ef51
6 changed files with 159 additions and 23 deletions

View File

@@ -594,7 +594,7 @@ static bool bolt12_has_request_prefix(const char *str)
return strstarts(str, "lnr1") || strstarts(str, "LNR1");
}
static bool bolt12_has_offer_prefix(const char *str)
bool bolt12_has_offer_prefix(const char *str)
{
return strstarts(str, "lno1") || strstarts(str, "LNO1");
}

View File

@@ -125,6 +125,7 @@ void offer_period_paywindow(const struct recurrence *recurrence,
/**
* Preliminary prefix check to see if the string might be a bolt12 string.
*/
bool bolt12_has_offer_prefix(const char *str);
bool bolt12_has_prefix(const char *str);
/**