Browse Source

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 <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
1356913143
  1. 4
      lightningd/invoice.c

4
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);
}

Loading…
Cancel
Save