Skip to content
Merged
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.

10 changes: 9 additions & 1 deletion 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 an invoice request."
]
}
}
},
Expand Down Expand Up @@ -37560,7 +37567,8 @@
"id": "example:xpay#2",
"method": "xpay",
"params": {
"invstring": "lni1qqg0qe03030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303"
"invstring": "lni1qqg0qe03030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303",
"payer_note": "Coffee payment"
}
},
"response": {
Expand Down
148 changes: 74 additions & 74 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion 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 an invoice request."
]
}
}
},
Expand Down Expand Up @@ -151,7 +158,8 @@
"id": "example:xpay#2",
"method": "xpay",
"params": {
"invstring": "lni1qqg0qe03030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303"
"invstring": "lni1qqg0qe03030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303",
"payer_note": "Coffee payment"
}
},
"response": {
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);
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;
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
3 changes: 2 additions & 1 deletion tests/autogenerate-rpc-examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,8 @@ def generate_transactions_examples(l1, l2, l3, l4, l5, c25, bitcoind):
xpay_res1 = update_example(node=l1, method='xpay', params=[inv_l41['bolt11']])
offer_l11 = l1.rpc.offer('any')
inv_l14 = l1.rpc.fetchinvoice(offer_l11['bolt12'], '1000msat')
xpay_res2 = update_example(node=l1, method='xpay', params={'invstring': inv_l14['invoice']})
xpay_res2 = update_example(node=l1, method='xpay', params={'invstring': inv_l14['invoice'],
'payer_note': "Coffee payment"})

update_example(node=l1, method='injectonionmessage', params={'message': '0002cb7cd2001e3c670d64135542dcefdf4a3f590eb142cee9277b317848471906caeabe4afeae7f4e31f6ca9c119b643d5369c5e55f892f205469a185f750697124a2bb7ccea1245ec12d76340bcf7371ba6d1c9ddfe09b4153fce524417c14a594fdbb5e7c698a5daffe77db946727a38711be2ecdebdd347d2a9f990810f2795b3c39b871d7c72a11534bd388ca2517630263d96d8cc72d146bae800638066175c85a8e8665160ea332ed7d27efc31c960604d61c3f83801c25cbb69ae3962c2ef13b1fa9adc8dcbe3dc8d9a5e27ff5669e076b02cafef8f2c88fc548e03642180d57606386ad6ce27640339747d40f26eb5b9e93881fc8c16d5896122032b64bb5f1e4be6f41f5fa4dbd7851989aeccd80b2d5f6f25427f171964146185a8eaa57891d91e49a4d378743231e19edd5994c3118c9a415958a5d9524a6ecc78c0205f5c0059a7fbcf1abad706a189b712476d112521c9a4650d0ff09890536acae755a2b07d00811044df28b288d3dc2d5ae3f8bf3cf7a2950e2167105dfad0fb8398ef08f36abcdb1bfd6aca3241c33810f0750f35bdfb7c60b1759275b7704ab1bc8f3ea375b3588eab10e4f948f12fe0a3c77b67bebeedbcced1de0f0715f9959e5497cda5f8f6ab76c15b3dcc99956465de1bf2855338930650f8e8e8c391d9bb8950125dd60d8289dade0556d9dc443761983e26adcc223412b756e2fd9ad64022859b6cab20e8ffc3cf39ae6045b2c3338b1145ee3719a098e58c425db764d7f9a5034dbb730c20202f79bc3c53fab78ecd530aa0e8f7698c9ea53cb96dc9c639282c362d31177c5b81979f46f2db6090b8e171db47287523f28c462e35ef489b51426387f2709c342083968153b5f8a51cd5716b38106bb0f21c5ccfc28dd7c74b71c8367ae8ca348f66a7996bbc535076a1f65d9109658ec042257ca7523488fb1807dc8bec42739ccae066739cf58083b4e2c65e52e1747a6ec2aa26338bb6f2c3195a2b160e26dec70a2cfde269fa7c10c45d346a8bcc313bb618324edadc0291d15f4dc00ca3a7ad7131045fdf6978ba52178f4699525efcb8d96561630e2f28eaa97c66c38c66301b6c6f0124b550db620b09f35b9d45d1441cab7d93be5e3c39b9becfab7f8d05dd3a7a6e27a1d3f23f1dd01e967f5206600619f75439181848f7f4148216c11314b4eaf64c28c268ad4b33ea821d57728e9a9e9e1b6c4bcf35d14958295fc5f92bd6846f33c46f5fa20f569b25bc916b94e554f27a37448f873497e13baef8c740a7587828cc4136dd21b8584e6983e376e91663f8f91559637738b400fb49940fc2df299dfd448604b63c2f5d1f1ec023636f3baf2be5730364afd38191726a7c0d9477b1f231da4d707aabc6ad8036488181dbdb16b48500f2333036629004504d3524f87ece6afb04c4ba03ea6fce069e98b1ab7bf51f237d7c0f40756744dd703c6023b6461b90730f701404e8dddfaff40a9a60e670be7729556241fc9cc8727a586e38b71616bff8772c873b37d920d51a6ad31219a24b12f268545e2cfeb9e662236ab639fd4ecf865612678471ff7b320c934a13ca1f2587fc6a90f839c3c81c0ff84b51330820431418918e8501844893b53c1e0de46d51a64cb769974a996c58ff06683ebdc46fd4bb8e857cecebab785a351c64fd486fb648d25936cb09327b70d22c243035d4343fa3d2d148e2df5cd928010e34ae42b0333e698142050d9405b39f3aa69cecf8a388afbc7f199077b911cb829480f0952966956fe57d815f0d2467f7b28af11f8820645b601c0e1ad72a4684ebc60287d23ec3502f4c65ca44f5a4a0d79e3a5718cd23e7538cb35c57673fb9a1173e5526e767768117c7fefc2e3718f44f790b27e61995fecc6aef05107e75355be301ebe1500c147bb655a159f',
'path_key': '03ccf3faa19e8d124f27d495e3359f4002a6622b9a02df9a51b609826d354cda52'})
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