diff --git a/lightningd/dual_open_control.c b/lightningd/dual_open_control.c index 52e9bfb74..25a6a575c 100644 --- a/lightningd/dual_open_control.c +++ b/lightningd/dual_open_control.c @@ -654,7 +654,7 @@ wallet_commit_channel(struct lightningd *ld, struct amount_sat total_funding, struct amount_sat our_funding, u8 channel_flags, - struct channel_info *channel_info, + const struct channel_info *channel_info, u32 feerate, enum side opener, const u8 *our_upfront_shutdown_script, @@ -678,9 +678,6 @@ wallet_commit_channel(struct lightningd *ld, return NULL; } - /* old_remote_per_commit not valid yet, copy valid one. */ - channel_info->old_remote_per_commit = channel_info->remote_per_commit; - /* BOLT-7b04b1461739c5036add61782d58ac490842d98b #9 * | 222/223 | `option_dual_fund` * | Use v2 of channel open, enables dual funding @@ -816,6 +813,9 @@ static void accepter_commit_received(struct subd *dualopend, goto failed; } + /* old_remote_per_commit not valid yet, copy valid one. */ + channel_info.old_remote_per_commit = channel_info.remote_per_commit; + payload->rcvd->channel = wallet_commit_channel(ld, uc, &cid, diff --git a/lightningd/opening_control.c b/lightningd/opening_control.c index 7e42741ac..fcf124664 100644 --- a/lightningd/opening_control.c +++ b/lightningd/opening_control.c @@ -376,6 +376,9 @@ static void opening_funder_finished(struct subd *openingd, const u8 *resp, /* Saved with channel to disk */ derive_channel_id(&cid, &funding_txid, funding_txout); + /* old_remote_per_commit not valid yet, copy valid one. */ + channel_info.old_remote_per_commit = channel_info.remote_per_commit; + /* Steals fields from uc */ channel = wallet_commit_channel(ld, fc->uc, &cid, @@ -481,6 +484,9 @@ static void opening_fundee_finished(struct subd *openingd, derive_channel_id(&cid, &funding_txid, funding_outnum); + /* old_remote_per_commit not valid yet, copy valid one. */ + channel_info.old_remote_per_commit = channel_info.remote_per_commit; + /* Consumes uc */ channel = wallet_commit_channel(ld, uc, &cid,