From 13569131431ae84c59c56c82d294ccecd91c6b11 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 15 Dec 2017 20:59:18 +1030 Subject: [PATCH] invoice: remove strange code. This is called when we load from database: clearly our tests aren't thorough enough because we were allocating and initializing `r` in an unused structure. invs is also the owner already; functions which steal are a bit surprising to callers, so we either document them, or just don't do it. Signed-off-by: Rusty Russell --- lightningd/invoice.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lightningd/invoice.c b/lightningd/invoice.c index 55703d13e..b956fd6f2 100644 --- a/lightningd/invoice.c +++ b/lightningd/invoice.c @@ -60,9 +60,7 @@ static struct invoice *find_invoice_by_label(const struct invoices *invs, void invoice_add(struct invoices *invs, struct invoice *inv) { - tal_steal(invs, inv); - struct invoice *invoice = tal(invs, struct invoice); - sha256(&invoice->rhash, invoice->r.r, sizeof(invoice->r.r)); + sha256(&inv->rhash, inv->r.r, sizeof(inv->r.r)); list_add(&invs->invlist, &inv->list); }