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
12 changes: 12 additions & 0 deletions .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,7 @@
"DelPay.payments[].completed_at": 11,
"DelPay.payments[].created_at": 9,
"DelPay.payments[].created_index": 1,
"DelPay.payments[].description": 18,
"DelPay.payments[].destination": 7,
"DelPay.payments[].erroronion": 17,
"DelPay.payments[].groupid": 12,
Expand Down Expand Up @@ -3611,6 +3612,7 @@
"SendOnion.bolt12": 10,
"SendOnion.created_at": 6,
"SendOnion.created_index": 14,
"SendOnion.description": 16,
"SendOnion.destination": 5,
"SendOnion.id": 1,
"SendOnion.label": 8,
Expand Down Expand Up @@ -3653,6 +3655,7 @@
"SendPay.completed_at": 15,
"SendPay.created_at": 7,
"SendPay.created_index": 16,
"SendPay.description": 18,
"SendPay.destination": 6,
"SendPay.groupid": 2,
"SendPay.id": 1,
Expand Down Expand Up @@ -4047,6 +4050,7 @@
"WaitSendPay.completed_at": 14,
"WaitSendPay.created_at": 7,
"WaitSendPay.created_index": 15,
"WaitSendPay.description": 17,
"WaitSendPay.destination": 6,
"WaitSendPay.groupid": 2,
"WaitSendPay.id": 1,
Expand Down Expand Up @@ -6904,6 +6908,10 @@
"added": "v23.11",
"deprecated": null
},
"DelPay.payments[].description": {
"added": "v26.04",
"deprecated": null
},
"DelPay.payments[].destination": {
"added": "pre-v0.10.1",
"deprecated": null
Expand Down Expand Up @@ -13948,6 +13956,10 @@
"added": "v23.11",
"deprecated": null
},
"WaitSendPay.description": {
"added": "v26.04",
"deprecated": null
},
"WaitSendPay.destination": {
"added": "pre-v0.10.1",
"deprecated": null
Expand Down
3 changes: 3 additions & 0 deletions cln-grpc/proto/node.proto

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

3 changes: 3 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.

6 changes: 6 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.

23 changes: 23 additions & 0 deletions contrib/msggen/msggen/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -11000,6 +11000,13 @@
"The bolt12 string (if supplied for pay)."
]
},
"description": {
"added": "v26.04",
"type": "string",
"description": [
"The description matching the bolt11 description hash (if pay supplied one)."
]
},
"erroronion": {
"type": "hex",
"description": [
Expand Down Expand Up @@ -32033,6 +32040,12 @@
"The bolt12 string (if supplied)."
]
},
"description": {
"type": "string",
"description": [
"The description matching the bolt11 description hash (if pay supplied one)."
]
},
"message": {},
"payment_preimage": {}
},
Expand Down Expand Up @@ -32072,6 +32085,7 @@
"partid": {},
"bolt11": {},
"bolt12": {},
"description": {},
"payment_preimage": {
"type": "secret",
"description": [
Expand Down Expand Up @@ -32116,6 +32130,7 @@
"partid": {},
"bolt11": {},
"bolt12": {},
"description": {},
"message": {
"type": "string",
"description": [
Expand Down Expand Up @@ -37027,6 +37042,13 @@
"The bolt12 string (if supplied for pay)."
]
},
"description": {
"added": "v26.04",
"type": "string",
"description": [
"The description matching the bolt11 description hash (if pay supplied one)."
]
},
"message": {},
"payment_preimage": {}
},
Expand Down Expand Up @@ -37066,6 +37088,7 @@
"partid": {},
"bolt11": {},
"bolt12": {},
"description": {},
"payment_preimage": {
"type": "secret",
"description": [
Expand Down
2,300 changes: 1,150 additions & 1,150 deletions contrib/pyln-grpc-proto/pyln/grpc/node_pb2.py

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions contrib/pyln-testing/pyln/testing/grpc2py.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def sendpay2py(m):
"completed_at": m.completed_at, # PrimitiveField in generate_composite
"created_at": m.created_at, # PrimitiveField in generate_composite
"created_index": m.created_index, # PrimitiveField in generate_composite
"description": m.description, # PrimitiveField in generate_composite
"destination": hexlify(m.destination), # PrimitiveField in generate_composite
"groupid": m.groupid, # PrimitiveField in generate_composite
"id": m.id, # PrimitiveField in generate_composite
Expand Down Expand Up @@ -787,6 +788,7 @@ def waitsendpay2py(m):
"completed_at": m.completed_at, # PrimitiveField in generate_composite
"created_at": m.created_at, # PrimitiveField in generate_composite
"created_index": m.created_index, # PrimitiveField in generate_composite
"description": m.description, # PrimitiveField in generate_composite
"destination": hexlify(m.destination), # PrimitiveField in generate_composite
"groupid": m.groupid, # PrimitiveField in generate_composite
"id": m.id, # PrimitiveField in generate_composite
Expand Down Expand Up @@ -1396,6 +1398,7 @@ def delpay_payments2py(m):
"completed_at": m.completed_at, # PrimitiveField in generate_composite
"created_at": m.created_at, # PrimitiveField in generate_composite
"created_index": m.created_index, # PrimitiveField in generate_composite
"description": m.description, # PrimitiveField in generate_composite
"destination": hexlify(m.destination), # PrimitiveField in generate_composite
"erroronion": hexlify(m.erroronion), # PrimitiveField in generate_composite
"groupid": m.groupid, # PrimitiveField in generate_composite
Expand Down
7 changes: 7 additions & 0 deletions doc/schemas/delpay.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@
"The bolt12 string (if supplied for pay)."
]
},
"description": {
"added": "v26.04",
"type": "string",
"description": [
"The description matching the bolt11 description hash (if pay supplied one)."
]
},
"erroronion": {
"type": "hex",
"description": [
Expand Down
8 changes: 8 additions & 0 deletions doc/schemas/sendpay.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@
"The bolt12 string (if supplied)."
]
},
"description": {
"type": "string",
"description": [
"The description matching the bolt11 description hash (if pay supplied one)."
]
},
"message": {},
"payment_preimage": {}
},
Expand Down Expand Up @@ -272,6 +278,7 @@
"partid": {},
"bolt11": {},
"bolt12": {},
"description": {},
"payment_preimage": {
"type": "secret",
"description": [
Expand Down Expand Up @@ -316,6 +323,7 @@
"partid": {},
"bolt11": {},
"bolt12": {},
"description": {},
"message": {
"type": "string",
"description": [
Expand Down
8 changes: 8 additions & 0 deletions doc/schemas/waitsendpay.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@
"The bolt12 string (if supplied for pay)."
]
},
"description": {
"added": "v26.04",
"type": "string",
"description": [
"The description matching the bolt11 description hash (if pay supplied one)."
]
},
"message": {},
"payment_preimage": {}
},
Expand Down Expand Up @@ -191,6 +198,7 @@
"partid": {},
"bolt11": {},
"bolt12": {},
"description": {},
"payment_preimage": {
"type": "secret",
"description": [
Expand Down
49 changes: 44 additions & 5 deletions lightningd/pay.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,39 @@
#include <lightningd/peer_htlcs.h>
#include <wallet/invoices.h>

/* Helper functions for extracting description from bolt11/12 string*/
static const char *decode_bolt11_description_simple(const tal_t *ctx,
const char *invstr)
{
char *fail;
struct bolt11 *b11 = bolt11_decode(ctx, invstr, NULL, NULL, NULL, &fail);
if (!b11)
return NULL;

if (!b11->description)
return NULL;

return tal_strdup(ctx, b11->description);
}

static const char *decode_bolt12_description(const tal_t *ctx,
const char *invstr)
{
char *fail;
struct tlv_invoice *tinv =
invoice_decode(ctx, invstr, strlen(invstr), NULL, NULL, &fail);

if (!tinv)
return NULL;

if (!tinv->invreq_payer_note)
return NULL;

return tal_hexstr(ctx,
tinv->invreq_payer_note,
tal_count(tinv->invreq_payer_note));
}

/* Routing failure object */
struct routing_failure {
unsigned int erring_index;
Expand Down Expand Up @@ -138,6 +171,7 @@ add_waitsendpay_waiter_(struct lightningd *ld,
void json_add_payment_fields(struct json_stream *response,
const struct wallet_payment *t)
{
const char *description = NULL;
json_add_u64(response, "created_index", t->id);
json_add_u64(response, "id", t->id);
json_add_sha256(response, "payment_hash", &t->payment_hash);
Expand Down Expand Up @@ -176,13 +210,18 @@ void json_add_payment_fields(struct json_stream *response,
if (t->label)
json_add_string(response, "label", t->label);
if (t->invstring) {
if (strstarts(t->invstring, "lni"))
json_add_string(response, "bolt12", t->invstring);
else
json_add_string(response, "bolt11", t->invstring);
}
if (strstarts(t->invstring, "lni")) {
json_add_string(response, "bolt12", t->invstring);
description = decode_bolt12_description(response, t->invstring);
} else {
json_add_string(response, "bolt11", t->invstring);
description = decode_bolt11_description_simple(response, t->invstring);
}
}
if (t->description)
json_add_string(response, "description", t->description);
else if (description)
json_add_string(response, "description", description);

if (t->failonion)
json_add_hex(response, "erroronion", t->failonion,
Expand Down