mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
offers: neater response on malformed invoice.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -28,12 +28,15 @@ fail_inv_level(struct command *cmd,
|
|||||||
struct tlv_invoice_error *err;
|
struct tlv_invoice_error *err;
|
||||||
u8 *errdata;
|
u8 *errdata;
|
||||||
|
|
||||||
full_fmt = tal_fmt(tmpctx, "Failed invoice %s",
|
full_fmt = tal_fmt(tmpctx, "Failed invoice");
|
||||||
|
if (inv->inv) {
|
||||||
|
tal_append_fmt(&full_fmt, " %s",
|
||||||
invoice_encode(tmpctx, inv->inv));
|
invoice_encode(tmpctx, inv->inv));
|
||||||
if (inv->inv->offer_id)
|
if (inv->inv->offer_id)
|
||||||
tal_append_fmt(&full_fmt, " for offer %s",
|
tal_append_fmt(&full_fmt, " for offer %s",
|
||||||
type_to_string(tmpctx, struct sha256,
|
type_to_string(tmpctx, struct sha256,
|
||||||
inv->inv->offer_id));
|
inv->inv->offer_id));
|
||||||
|
}
|
||||||
tal_append_fmt(&full_fmt, ": %s", fmt);
|
tal_append_fmt(&full_fmt, ": %s", fmt);
|
||||||
|
|
||||||
msg = tal_vfmt(tmpctx, full_fmt, ap);
|
msg = tal_vfmt(tmpctx, full_fmt, ap);
|
||||||
|
|||||||
@@ -38,12 +38,15 @@ fail_invreq_level(struct command *cmd,
|
|||||||
struct tlv_invoice_error *err;
|
struct tlv_invoice_error *err;
|
||||||
u8 *errdata;
|
u8 *errdata;
|
||||||
|
|
||||||
full_fmt = tal_fmt(tmpctx, "Failed invoice_request %s",
|
full_fmt = tal_fmt(tmpctx, "Failed invoice_request");
|
||||||
|
if (invreq->invreq) {
|
||||||
|
tal_append_fmt(&full_fmt, " %s",
|
||||||
invrequest_encode(tmpctx, invreq->invreq));
|
invrequest_encode(tmpctx, invreq->invreq));
|
||||||
if (invreq->invreq->offer_id)
|
if (invreq->invreq->offer_id)
|
||||||
tal_append_fmt(&full_fmt, " for offer %s",
|
tal_append_fmt(&full_fmt, " for offer %s",
|
||||||
type_to_string(tmpctx, struct sha256,
|
type_to_string(tmpctx, struct sha256,
|
||||||
invreq->invreq->offer_id));
|
invreq->invreq->offer_id));
|
||||||
|
}
|
||||||
tal_append_fmt(&full_fmt, ": %s", fmt);
|
tal_append_fmt(&full_fmt, ": %s", fmt);
|
||||||
|
|
||||||
msg = tal_vfmt(tmpctx, full_fmt, ap);
|
msg = tal_vfmt(tmpctx, full_fmt, ap);
|
||||||
|
|||||||
Reference in New Issue
Block a user