plugins/offers: establish_onion_path can have a simple boolean arg for connect_disable.

It's always the same string, so simplify the interface.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2024-07-09 18:12:44 +09:30 committed by Vincenzo Palazzo
parent 34052f9960
commit 0c7ce27a39
4 changed files with 9 additions and 11 deletions

View file

@ -9,7 +9,7 @@
struct connect_info {
struct pubkey local_id, dst;
const char *connect_disable;
bool connect_disable;
struct gossmap *gossmap;
struct command_result *(*cb)(struct command *,
const struct pubkey *,
@ -47,9 +47,7 @@ static struct command_result *connect_direct(struct command *cmd,
struct out_req *req;
if (ci->connect_disable) {
return ci->fail(cmd,
tal_fmt(tmpctx, "%s set: not initiating a new connection",
ci->connect_disable),
return ci->fail(cmd, "fetchinvoice-noconnect set: not initiating a new connection",
ci->arg);
}
@ -149,7 +147,7 @@ struct command_result *establish_onion_path_(struct command *cmd,
struct gossmap *gossmap,
const struct pubkey *local_id,
const struct pubkey *dst,
const char *connect_disable,
bool connect_disable,
struct command_result *(*success)(struct command *,
const struct pubkey *,
void *arg),

View file

@ -12,7 +12,7 @@ struct gossmap;
* @gossmap: a gossip map to do lookup in
* @local_id: our own id
* @dst: the destination node
* @connect_disable: if non-null, the arg name which is disabling direct connection
* @connect_disable: true if we cannot reach out to connect to nodes.
* @success: the success callback
* @fail: the failure callback
* @arg: callback argument
@ -24,7 +24,7 @@ struct command_result *establish_onion_path_(struct command *cmd,
struct gossmap *gossmap,
const struct pubkey *local_id,
const struct pubkey *dst,
const char *connect_disable,
bool connect_disable,
struct command_result *(*success)(struct command *,
const struct pubkey *,
void *arg),

View file

@ -787,7 +787,7 @@ static struct command_result *invreq_done(struct command *cmd,
return establish_onion_path(cmd, get_gossmap(cmd->plugin), &local_id,
sent->invreq->offer_node_id,
disable_connect ? "fetchinvoice-noconnect" : NULL,
disable_connect,
fetchinvoice_path_done,
fetchinvoice_path_fail,
sent);
@ -1136,7 +1136,7 @@ static struct command_result *createinvoice_done(struct command *cmd,
return establish_onion_path(cmd, get_gossmap(cmd->plugin), &local_id,
sent->invreq->invreq_payer_id,
disable_connect ? "fetchinvoice-noconnect" : NULL,
disable_connect,
sendinvoice_path_done,
sendinvoice_path_fail,
sent);
@ -1428,7 +1428,7 @@ static struct command_result *json_dev_rawrequest(struct command *cmd,
return establish_onion_path(cmd, get_gossmap(cmd->plugin), &local_id,
node_id,
disable_connect ? "fetchinvoice-noconnect" : NULL,
disable_connect,
fetchinvoice_path_done,
fetchinvoice_path_fail,
sent);

View file

@ -1154,7 +1154,7 @@ struct command_result *handle_invoice_request(struct command *cmd,
/* Before any failure, make sure we can reach first node! */
return establish_onion_path(cmd, get_gossmap(cmd->plugin), &id,
&reply_path->first_node_id.pubkey,
disable_connect ? "offers-noconnect" : NULL,
disable_connect,
invoice_request_path_done,
invoice_request_path_fail,
ir);