From 1d57fa60b82f32c17e1d3bf4314515c923b78677 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 1 Nov 2016 21:34:58 +1030 Subject: [PATCH] invoice: print duplicate r value even if we choose it. This shouldn't happen, but if our RNG is busted and get a duplicate, r would be NULL. (scan-build found this) Signed-off-by: Rusty Russell --- daemon/invoice.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/daemon/invoice.c b/daemon/invoice.c index dea17d14c..ef719f654 100644 --- a/daemon/invoice.c +++ b/daemon/invoice.c @@ -2,6 +2,7 @@ #include "invoice.h" #include "jsonrpc.h" #include "lightningd.h" +#include "utils.h" #include #include #include @@ -130,8 +131,9 @@ static void json_invoice(struct command *cmd, sha256(&invoice->rhash, invoice->r.r, sizeof(invoice->r.r)); if (find_unpaid(cmd->dstate, &invoice->rhash) || find_paid(cmd->dstate, &invoice->rhash)) { - command_fail(cmd, "Duplicate r value '%.*s'", - r->end - r->start, buffer + r->start); + command_fail(cmd, "Duplicate r value '%s'", + tal_hexstr(cmd, &invoice->rhash, + sizeof(invoice->rhash))); return; }