liquidity-ads: persist channel blockheight states to disk

Adds new tables to database, backfills, basically copies the fee_rates
state machine for channeld.
This commit is contained in:
niftynei
2021-06-22 13:25:59 -05:00
committed by neil saitug
parent a396c341cf
commit 265f960cfe
72 changed files with 1414 additions and 441 deletions

View File

@@ -5,6 +5,7 @@
#include <ccan/mem/mem.h>
#include <ccan/tal/str/str.h>
#include <common/addr.h>
#include <common/blockheight_states.h>
#include <common/channel_config.h>
#include <common/features.h>
#include <common/fee_states.h>
@@ -105,6 +106,7 @@ wallet_commit_channel(struct lightningd *ld,
s64 final_key_idx;
u64 static_remotekey_start;
bool option_anchor_outputs;
u32 lease_start_blockheight = 0; /* No leases on v1 */
/* We cannot both be the fundee *and* have a `fundchannel_start`
* command running!
@@ -217,6 +219,8 @@ wallet_commit_channel(struct lightningd *ld,
NUM_SIDES, /* closer not yet known */
uc->fc ? REASON_USER : REASON_REMOTE,
NULL,
take(new_height_states(NULL, uc->fc ? LOCAL : REMOTE,
&lease_start_blockheight)),
0, NULL, 0, 0); /* No leases on v1s */
/* Now we finally put it in the database. */