df-feerates: send back original + last known feerates

For calculating the next RBF attempt's feerate, we need some historical
information about the feerate used for this channel
This commit is contained in:
niftynei
2021-01-25 12:34:47 -06:00
committed by neil saitug
parent fe688ab718
commit 063948d51a
5 changed files with 42 additions and 17 deletions

View File

@@ -2162,7 +2162,7 @@ static void handle_commit_received(struct subd *dualopend,
struct bitcoin_signature remote_commit_sig;
struct bitcoin_txid funding_txid;
u16 funding_outnum;
u32 feerate_funding, feerate_commitment = 0;
u32 feerate_funding, feerate_commitment;
struct amount_sat total_funding, funding_ours;
u8 *remote_upfront_shutdown_script,
*local_upfront_shutdown_script;
@@ -2195,6 +2195,7 @@ static void handle_commit_received(struct subd *dualopend,
&funding_ours,
&channel->channel_flags,
&feerate_funding,
&feerate_commitment,
&channel->our_config.channel_reserve,
&local_upfront_shutdown_script,
&remote_upfront_shutdown_script)) {
@@ -2493,7 +2494,7 @@ void peer_restart_dualopend(struct peer *peer,
u32 max_to_self_delay;
struct amount_msat min_effective_htlc_capacity;
struct channel_config unused_config;
struct channel_inflight *inflight;
struct channel_inflight *inflight, *first_inflight;
int hsmfd;
u8 *msg;
@@ -2532,6 +2533,11 @@ void peer_restart_dualopend(struct peer *peer,
&min_effective_htlc_capacity);
inflight = channel_current_inflight(channel);
/* Get the first inflight to figure out the original feerate
* for this channel. It's fine if it's the same as the current */
first_inflight = list_top(&channel->inflights,
struct channel_inflight,
list);
msg = towire_dualopend_reinit(NULL,
chainparams,
peer->ld->our_features,
@@ -2548,8 +2554,10 @@ void peer_restart_dualopend(struct peer *peer,
channel->minimum_depth,
feerate_min(peer->ld, NULL),
feerate_max(peer->ld, NULL),
&channel->funding_txid,
channel->funding_outnum,
&inflight->funding->txid,
inflight->funding->outnum,
first_inflight->funding->feerate,
inflight->funding->feerate,
channel->funding,
channel->our_msat,
&channel->channel_info.theirbase,