Skip to content

Commit 3caad8e

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 88d73d4 commit 3caad8e

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
@@ -530,6 +530,10 @@ delete the others.
530530

531531
### Payment and invoice control options:
532532

533+
* **payment-fronting-node**=*nodeid*
534+
535+
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.
536+
533537
* **disable-mpp** [plugin `pay`]
534538

535539
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
@@ -378,6 +378,7 @@ static struct lightningd *new_lightningd(const tal_t *ctx)
378378
/* The gossip seeker automatically connects to a this many peers */
379379
ld->autoconnect_seeker_peers = 10;
380380

381+
ld->fronting_nodes = tal_arr(ld, struct node_id, 0);
381382
return ld;
382383
}
383384

lightningd/lightningd.h

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

427427
/* Minimum number of peers seeker should maintain. */
428428
u32 autoconnect_seeker_peers;
429+
430+
/* Nodes to use for invoices / offers */
431+
struct node_id *fronting_nodes;
429432
};
430433

431434
/* 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
@@ -1278,6 +1278,16 @@ static char *opt_add_api_beg(const char *arg, struct lightningd *ld)
12781278
return NULL;
12791279
}
12801280

1281+
static char *opt_add_node_id(const char *arg, struct node_id **arr)
1282+
{
1283+
struct node_id n;
1284+
if (!node_id_from_hexstr(arg, strlen(arg), &n))
1285+
return "Unparsable nodeid";
1286+
1287+
tal_arr_expand(arr, n);
1288+
return NULL;
1289+
}
1290+
12811291
char *hsm_secret_arg(const tal_t *ctx,
12821292
const char *arg,
12831293
const u8 **hsm_secret)
@@ -1598,6 +1608,10 @@ static void register_opts(struct lightningd *ld)
15981608
ld,
15991609
"Re-enable a long-deprecated API (which will be removed entirely next version!)");
16001610
opt_register_logging(ld);
1611+
clnopt_witharg("--payment-fronting-node",
1612+
OPT_MULTI,
1613+
opt_add_node_id, NULL,
1614+
&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.");
16011615

16021616
dev_register_opts(ld);
16031617
}
@@ -1854,6 +1868,7 @@ bool is_known_opt_cb_arg(char *(*cb_arg)(const char *, void *))
18541868
|| cb_arg == (void *)opt_subd_dev_disconnect
18551869
|| cb_arg == (void *)opt_set_crash_timeout
18561870
|| cb_arg == (void *)opt_add_api_beg
1871+
|| cb_arg == (void *)opt_add_node_id
18571872
|| cb_arg == (void *)opt_force_featureset
18581873
|| cb_arg == (void *)opt_force_privkey
18591874
|| cb_arg == (void *)opt_force_bip32_seed

0 commit comments

Comments
 (0)