mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-21 14:24:09 +01:00
lightningd: don't hand around partially-assembled channel_info.
wallet_commit_channel would fill in the old_remote_per_commit and fee_states, which is weird since the caller doesn't care. Make the caller set all the channel_info fields, so wallet_commit_channel is a simple consumer. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
58f6e316cc
commit
7db8680530
2 changed files with 10 additions and 4 deletions
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue