lightningd: save the fee_states into the database.

This is the final step: we pass the complete fee_states to and from
channeld.

Changelog-Fixed: "Bad commitment signature" closing channels when we sent back-to-back update_fee messages across multiple reconnects.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-12-13 03:48:25 +10:30
committed by Christian Decker
parent 4270031d75
commit 72aa315b5e
19 changed files with 191 additions and 90 deletions

View File

@@ -449,7 +449,8 @@ static void json_add_htlcs(struct lightningd *ld,
struct htlc_in_map_iter ini;
const struct htlc_out *hout;
struct htlc_out_map_iter outi;
u32 local_feerate = channel->channel_info.feerate_per_kw[LOCAL];
u32 local_feerate = get_feerate(channel->channel_info.fee_states,
channel->funder, LOCAL);
/* FIXME: Add more fields. */
json_array_start(response, "htlcs");
@@ -519,7 +520,8 @@ static struct amount_sat commit_txfee(const struct channel *channel,
const struct htlc_out *hout;
struct htlc_out_map_iter outi;
struct lightningd *ld = channel->peer->ld;
u32 local_feerate = channel->channel_info.feerate_per_kw[LOCAL];
u32 local_feerate = get_feerate(channel->channel_info.fee_states,
channel->funder, LOCAL);
size_t num_untrimmed_htlcs = 0;
/* Assume we tried to spend "spendable" */