Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -4073,6 +4073,7 @@
"Xpay.maxdelay": 7,
"Xpay.maxfee": 3,
"Xpay.partial_msat": 6,
"Xpay.payer_note": 8,
"Xpay.retry_for": 5
},
"XpayResponse": {
Expand Down Expand Up @@ -14044,6 +14045,10 @@
"added": "v24.11",
"deprecated": null
},
"Xpay.payer_note": {
"added": "v26.04",
"deprecated": null
},
"Xpay.payment_preimage": {
"added": "v24.11",
"deprecated": null
Expand Down
1 change: 1 addition & 0 deletions cln-grpc/proto/node.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions cln-grpc/src/convert.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions cln-rpc/src/model.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions contrib/msggen/msggen/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -37474,6 +37474,13 @@
"A payment may be delayed for up to `maxdelay` blocks by another node; clients should be prepared for this worst case."
],
"default": "2016"
},
"payer_note": {
"type": "string",
"added": "v26.04",
"description": [
"A message that a payer is willing to send to a payee within a payment."
]
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from pyln.grpc import node_pb2 as node__pb2

GRPC_GENERATED_VERSION = '1.75.1'
GRPC_GENERATED_VERSION = '1.76.0'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI is currently failing due to version mismatch in your grpcio. Please downgrade your local grpcio (uv pip install grpcio==1.75.1).

GRPC_VERSION = grpc.__version__
_version_not_supported = False

Expand All @@ -18,7 +18,7 @@
if _version_not_supported:
raise RuntimeError(
f'The grpc package installed is at version {GRPC_VERSION},'
+ f' but the generated code in node_pb2_grpc.py depends on'
+ ' but the generated code in node_pb2_grpc.py depends on'
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
Expand Down
7 changes: 7 additions & 0 deletions doc/schemas/xpay.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@
"A payment may be delayed for up to `maxdelay` blocks by another node; clients should be prepared for this worst case."
],
"default": "2016"
},
"payer_note": {
"type": "string",
"added": "v26.04",
"description": [
"A message that a payer is willing to send to a payee within a payment."
]
}
}
},
Expand Down
20 changes: 14 additions & 6 deletions plugins/xpay/xpay.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ static struct command_result *xpay_core(struct command *cmd,
u32 retryfor,
const struct amount_msat *partial,
u32 maxdelay,
bool as_pay);
bool as_pay);

/* Wrapper for pending commands (ignores return) */
static void was_pending(const struct command_result *res)
Expand Down Expand Up @@ -1790,6 +1790,7 @@ struct xpay_params {
unsigned int retryfor;
u32 maxdelay;
const char *bip353;
const char *payer_note;
};

static struct command_result *
Expand Down Expand Up @@ -1820,9 +1821,12 @@ do_fetchinvoice(struct command *cmd, const char *offerstr, struct xpay_params *x
json_add_string(req->js, "offer", offerstr);
if (xparams->msat)
json_add_amount_msat(req->js, "amount_msat", *xparams->msat);
if (xparams->bip353)
json_add_string(req->js, "bip353", xparams->bip353);
return send_outreq(req);
if (xparams->bip353)
json_add_string(req->js, "bip353", xparams->bip353);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mismatched alignment.

if (xparams->payer_note)
json_add_string(req->js, "payer_note", xparams->payer_note);

return send_outreq(req);
}

static struct command_result *
Expand Down Expand Up @@ -1867,7 +1871,8 @@ static struct command_result *json_xpay_params(struct command *cmd,
const char *invstring;
const char **layers;
u32 *maxdelay;
unsigned int *retryfor;
const char *payer_note;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: To keep the formatting consistent and avoid tabs/spaces alignment issues (especially between editors and the GitHub UI), could we format this to match the existing tab-based style?

unsigned int *retryfor;
struct out_req *req;
struct xpay_params *xparams;

Expand All @@ -1879,7 +1884,8 @@ static struct command_result *json_xpay_params(struct command *cmd,
p_opt_def("retry_for", param_number, &retryfor, 60),
p_opt("partial_msat", param_msat, &partial),
p_opt_def("maxdelay", param_u32, &maxdelay, 2016),
NULL))
p_opt("payer_note", param_string, &payer_note),
NULL))
return command_param_failed();

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

return do_fetchinvoice(cmd, invstring, xparams);
}
Expand All @@ -1915,6 +1922,7 @@ static struct command_result *json_xpay_params(struct command *cmd,
xparams->retryfor = *retryfor;
xparams->maxdelay = *maxdelay;
xparams->bip353 = invstring;
xparams->payer_note = payer_note;

req = jsonrpc_request_start(cmd, "fetchbip353",
bip353_fetched,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_xpay.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ def test_xpay_simple(node_factory):
b11 = l4.rpc.invoice('10000msat', 'test_xpay_simple', 'test_xpay_simple bolt11')['bolt11']
l1.rpc.xpay(b11)

# BOLT 12.
# BOLT 12 (with payer_note specified).
offer = l3.rpc.offer('any')['bolt12']
b12 = l1.rpc.fetchinvoice(offer, '100000msat')['invoice']
l1.rpc.xpay(b12)
l1.rpc.xpay(invstring=b12, payer_note="Payment for a cup of coffee")

# Failure from l4.
b11 = l4.rpc.invoice('10000msat', 'test_xpay_simple2', 'test_xpay_simple2 bolt11')['bolt11']
Expand Down
Loading