mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
offers: make decode command available even without experimental-offers.
It subsumes `decodepay`, and it's nicer if people can just assume it's available at all times. Changelog-Added: JSON-RPC: `decode` now available without `experimental-offers` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
neil saitug
parent
0496b0d25b
commit
a8b3a1c29c
@@ -17,6 +17,7 @@
|
||||
|
||||
struct pubkey32 id;
|
||||
u32 cltv_final;
|
||||
bool offers_enabled;
|
||||
|
||||
static struct command_result *finished(struct command *cmd,
|
||||
const char *buf,
|
||||
@@ -86,6 +87,9 @@ static struct command_result *onion_message_call(struct command *cmd,
|
||||
{
|
||||
const jsmntok_t *om, *invreqtok, *invtok;
|
||||
|
||||
if (!offers_enabled)
|
||||
return command_hook_success(cmd);
|
||||
|
||||
om = json_get_member(buf, params, "onion_message");
|
||||
|
||||
invreqtok = json_get_member(buf, om, "invoice_request");
|
||||
@@ -735,7 +739,6 @@ static const char *init(struct plugin *p,
|
||||
const jsmntok_t *config UNUSED)
|
||||
{
|
||||
struct pubkey k;
|
||||
bool exp_offers;
|
||||
|
||||
rpc_scan(p, "getinfo",
|
||||
take(json_out_obj(NULL, NULL, NULL)),
|
||||
@@ -748,10 +751,8 @@ static const char *init(struct plugin *p,
|
||||
take(json_out_obj(NULL, NULL, NULL)),
|
||||
"{cltv-final:%,experimental-offers:%}",
|
||||
JSON_SCAN(json_to_number, &cltv_final),
|
||||
JSON_SCAN(json_to_bool, &exp_offers));
|
||||
JSON_SCAN(json_to_bool, &offers_enabled));
|
||||
|
||||
if (!exp_offers)
|
||||
return "offers not enabled in config";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user