mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 17:44:20 +01:00
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>
This commit is contained in:
committed by
Rusty Russell
parent
eb5ed961ed
commit
c6f210a46c
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user