rbf: update the channel's funding_txid to match what's mined

If the peer is offline when we see the funding txid, we don't actually
update the channel's info. Here, we move it up to where the scid is set,
so that we always update the channel's funding_txid to the correct
(mined) information.
This commit is contained in:
niftynei
2021-05-20 16:50:42 -05:00
committed by Rusty Russell
parent e45b09358a
commit 062bc12813
9 changed files with 98 additions and 44 deletions

View File

@@ -159,9 +159,10 @@ new_inflight(struct channel *channel,
struct amount_sat total_funds,
struct amount_sat our_funds,
struct wally_psbt *psbt STEALS,
struct bitcoin_tx *last_tx STEALS,
struct bitcoin_tx *last_tx,
const struct bitcoin_signature last_sig)
{
struct wally_psbt *last_tx_psbt_clone;
struct channel_inflight *inflight
= tal(channel, struct channel_inflight);
struct funding_info *funding
@@ -177,7 +178,10 @@ new_inflight(struct channel *channel,
inflight->channel = channel;
inflight->remote_tx_sigs = false;
inflight->funding_psbt = tal_steal(inflight, psbt);
inflight->last_tx = tal_steal(inflight, last_tx);
/* Make a 'clone' of this tx */
last_tx_psbt_clone = clone_psbt(inflight, last_tx->psbt);
inflight->last_tx = bitcoin_tx_with_psbt(inflight, last_tx_psbt_clone);
inflight->last_sig = last_sig;
inflight->tx_broadcast = false;