Skip to content

Commit e70a5ef

Browse files
committed
lightningd: add payment-fronting-node option.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Added: Config: `payment-fronting-node` option to specify neighbor node(s) to use for all bolt11 invoices, bolt12 offers, invoices and invoice_requests.
1 parent 7fdccca commit e70a5ef

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

doc/lightningd-config.5.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,10 @@ delete the others.
518518

519519
### Payment and invoice control options:
520520

521+
* **payment-fronting-node**=*nodeid*
522+
523+
Always use this *nodeid* as the entry point when we generate invoices or offers. For BOLT11 invoices, this node must be a neighbor: we will use a routehint with the alias for the short channel id to provide limited privacy (we still reveal our node id). For BOLT12 invoices and offers , we provide a blinded path from the node to us, to provide better privacy.
524+
521525
* **disable-mpp** [plugin `pay`]
522526

523527
Disable the multi-part payment sending support in the `pay` plugin. By default

lightningd/lightningd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ static struct lightningd *new_lightningd(const tal_t *ctx)
384384
/* The gossip seeker automatically connects to a this many peers */
385385
ld->autoconnect_seeker_peers = 10;
386386

387+
ld->fronting_nodes = tal_arr(ld, struct node_id, 0);
387388
return ld;
388389
}
389390

lightningd/lightningd.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,9 @@ struct lightningd {
433433

434434
/* Minimum number of peers seeker should maintain. */
435435
u32 autoconnect_seeker_peers;
436+
437+
/* Nodes to use for invoices / offers */
438+
struct node_id *fronting_nodes;
436439
};
437440

438441
/* Turning this on allows a tal allocation to return NULL, rather than aborting.

lightningd/options.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,6 +1265,16 @@ static char *opt_add_api_beg(const char *arg, struct lightningd *ld)
12651265
return NULL;
12661266
}
12671267

1268+
static char *opt_add_node_id(const char *arg, struct node_id **arr)
1269+
{
1270+
struct node_id n;
1271+
if (!node_id_from_hexstr(arg, strlen(arg), &n))
1272+
return "Unparsable nodeid";
1273+
1274+
tal_arr_expand(arr, n);
1275+
return NULL;
1276+
}
1277+
12681278
char *hsm_secret_arg(const tal_t *ctx,
12691279
const char *arg,
12701280
const u8 **hsm_secret)
@@ -1578,6 +1588,10 @@ static void register_opts(struct lightningd *ld)
15781588
ld,
15791589
"Re-enable a long-deprecated API (which will be removed entirely next version!)");
15801590
opt_register_logging(ld);
1591+
clnopt_witharg("--payment-fronting-node",
1592+
OPT_MULTI,
1593+
opt_add_node_id, NULL,
1594+
&ld->fronting_nodes, "Put this node in all invoices and offers, and use blinded path (bolt12) or route hints (bolt11) to route to this node. Must be a neighboring node. Can be specified multiple times.");
15811595

15821596
/* Old bookkeeper migration flags. */
15831597
opt_register_early_arg("--bookkeeper-dir",
@@ -1844,6 +1858,7 @@ bool is_known_opt_cb_arg(char *(*cb_arg)(const char *, void *))
18441858
|| cb_arg == (void *)opt_subd_dev_disconnect
18451859
|| cb_arg == (void *)opt_set_crash_timeout
18461860
|| cb_arg == (void *)opt_add_api_beg
1861+
|| cb_arg == (void *)opt_add_node_id
18471862
|| cb_arg == (void *)opt_force_featureset
18481863
|| cb_arg == (void *)opt_force_privkey
18491864
|| cb_arg == (void *)opt_force_bip32_seed

0 commit comments

Comments
 (0)