Skip to content

Commit fbbcd7a

Browse files
committed
xpay: add payer_note field
Changelog-Added: Add 'payer-note' field to the 'xpay' RPC call.
1 parent 98a188b commit fbbcd7a

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

plugins/xpay/xpay.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static struct command_result *xpay_core(struct command *cmd,
181181
u32 retryfor,
182182
const struct amount_msat *partial,
183183
u32 maxdelay,
184-
bool as_pay);
184+
bool as_pay);
185185

186186
/* Wrapper for pending commands (ignores return) */
187187
static void was_pending(const struct command_result *res)
@@ -1790,6 +1790,7 @@ struct xpay_params {
17901790
unsigned int retryfor;
17911791
u32 maxdelay;
17921792
const char *bip353;
1793+
const char *payer_note;
17931794
};
17941795

17951796
static struct command_result *
@@ -1820,9 +1821,12 @@ do_fetchinvoice(struct command *cmd, const char *offerstr, struct xpay_params *x
18201821
json_add_string(req->js, "offer", offerstr);
18211822
if (xparams->msat)
18221823
json_add_amount_msat(req->js, "amount_msat", *xparams->msat);
1823-
if (xparams->bip353)
1824-
json_add_string(req->js, "bip353", xparams->bip353);
1825-
return send_outreq(req);
1824+
if (xparams->bip353)
1825+
json_add_string(req->js, "bip353", xparams->bip353);
1826+
if (xparams->payer_note)
1827+
json_add_string(req->js, "payer_note", xparams->payer_note);
1828+
1829+
return send_outreq(req);
18261830
}
18271831

18281832
static struct command_result *
@@ -1867,7 +1871,8 @@ static struct command_result *json_xpay_params(struct command *cmd,
18671871
const char *invstring;
18681872
const char **layers;
18691873
u32 *maxdelay;
1870-
unsigned int *retryfor;
1874+
const char *payer_note;
1875+
unsigned int *retryfor;
18711876
struct out_req *req;
18721877
struct xpay_params *xparams;
18731878

@@ -1879,7 +1884,8 @@ static struct command_result *json_xpay_params(struct command *cmd,
18791884
p_opt_def("retry_for", param_number, &retryfor, 60),
18801885
p_opt("partial_msat", param_msat, &partial),
18811886
p_opt_def("maxdelay", param_u32, &maxdelay, 2016),
1882-
NULL))
1887+
p_opt("payer_note", param_string, &payer_note),
1888+
NULL))
18831889
return command_param_failed();
18841890

18851891
/* Is this a one-shot vibe payment? Kids these days! */
@@ -1901,6 +1907,7 @@ static struct command_result *json_xpay_params(struct command *cmd,
19011907
xparams->retryfor = *retryfor;
19021908
xparams->maxdelay = *maxdelay;
19031909
xparams->bip353 = NULL;
1910+
xparams->payer_note = payer_note;
19041911

19051912
return do_fetchinvoice(cmd, invstring, xparams);
19061913
}
@@ -1915,6 +1922,7 @@ static struct command_result *json_xpay_params(struct command *cmd,
19151922
xparams->retryfor = *retryfor;
19161923
xparams->maxdelay = *maxdelay;
19171924
xparams->bip353 = invstring;
1925+
xparams->payer_note = payer_note;
19181926

19191927
req = jsonrpc_request_start(cmd, "fetchbip353",
19201928
bip353_fetched,

0 commit comments

Comments
 (0)