Browse Source

htlcs: Needed to add origin_htlc_id to outgoing HTLCs

While loading HTLCs from the database we might not yet have all the
incoming HTLCs loaded when loading a dependent htlc_out. So we defer
the wiring of the HTLCs until we are sure we have them loaded.

This is also the first step towards keeping that association only in
the database, since otherwise we cannot selectively load channels from
DB.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
ppa-0.6.1
Christian Decker 7 years ago
committed by Rusty Russell
parent
commit
c6f210a46c
  1. 1
      lightningd/htlc_end.h
  2. 1
      wallet/wallet.c

1
lightningd/htlc_end.h

@ -47,6 +47,7 @@ struct htlc_out {
* is saved to the database, must be >0 after saving to the
* database. */
u64 dbid;
u64 origin_htlc_id;
struct htlc_key key;
u64 msatoshi;
u32 cltv_expiry;

1
wallet/wallet.c

@ -884,6 +884,7 @@ bool wallet_htlc_save_out(struct wallet *wallet,
/* We absolutely need the incoming HTLC to be persisted before
* we can persist it's dependent */
assert(out->in == NULL || out->in->dbid != 0);
out->origin_htlc_id = out->in?out->in->dbid:0;
ok &= db_exec(
__func__, wallet->db,

Loading…
Cancel
Save