Skip to content

Commit dae2919

Browse files
committed
renepay: add a global payment layer
Changelog-None. Signed-off-by: Lagrang3 <[email protected]>
1 parent 3e3e5fe commit dae2919

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

plugins/renepay/main.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ static void memleak_mark(struct plugin *p, struct htable *memtable)
3636
memleak_scan_htable(memtable, &pay_plugin->pending_routes->raw);
3737
}
3838

39+
static struct command_result *createlayer_done(struct command *aux_cmd,
40+
const char *method,
41+
const char *buf,
42+
const jsmntok_t *result,
43+
void *unused)
44+
{
45+
return aux_command_done(aux_cmd);
46+
}
47+
3948
static const char *init(struct command *init_cmd,
4049
const char *buf UNUSED, const jsmntok_t *config UNUSED)
4150
{
@@ -93,6 +102,12 @@ static const char *init(struct command *init_cmd,
93102
__func__, skipped_count);
94103

95104
plugin_set_memleak_handler(p, memleak_mark);
105+
struct out_req *req =
106+
jsonrpc_request_start(aux_command(init_cmd), "askrene-create-layer",
107+
createlayer_done, plugin_broken_cb, NULL);
108+
json_add_string(req->js, "layer", RENEPAY_LAYER);
109+
json_add_bool(req->js, "persistent", true);
110+
send_outreq(req);
96111
return NULL;
97112
}
98113

plugins/renepay/mods.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,7 @@ static struct command_result *getroutes_cb(struct payment *payment)
728728
json_add_string(req->js, NULL, "auto.localchans");
729729
json_add_string(req->js, NULL, "auto.sourcefree");
730730
json_add_string(req->js, NULL, payment->payment_layer);
731+
json_add_string(req->js, NULL, RENEPAY_LAYER);
731732
json_array_end(req->js);
732733
// FIXME: add further constraints here if necessary when they become
733734
// available in getroutes

plugins/renepay/renepayconfig.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#define LIGHTNING_PLUGINS_RENEPAY_RENEPAYCONFIG_H
33
#include "config.h"
44

5+
#define RENEPAY_LAYER "renepay"
6+
57
#define MAX_NUM_ATTEMPTS 10
68

79
/* Knowledge is proportionally decreased with time up to TIMER_FORGET_SEC when

0 commit comments

Comments
 (0)