lightningd: use channel_type, pass to-and-from channeld.

Instead of explicit option_static_remotekey and option_anchor_outputs flags.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-09-09 14:59:35 +09:30
committed by Christian Decker
parent 740afb822c
commit 183fe107e8
57 changed files with 245 additions and 230 deletions

View File

@@ -105,7 +105,7 @@ wallet_commit_channel(struct lightningd *ld,
struct amount_sat local_funding;
s64 final_key_idx;
u64 static_remotekey_start;
bool option_anchor_outputs;
struct channel_type *type;
u32 lease_start_blockheight = 0; /* No leases on v1 */
/* We cannot both be the fundee *and* have a `fundchannel_start`
@@ -161,18 +161,13 @@ wallet_commit_channel(struct lightningd *ld,
* - MUST use that `channel_type` for all commitment transactions.
*/
/* i.e. We set it now for the channel permanently. */
if (feature_negotiated(ld->our_features,
uc->peer->their_features,
OPT_STATIC_REMOTEKEY))
type = default_channel_type(NULL,
ld->our_features, uc->peer->their_features);
if (channel_type_has(type, OPT_STATIC_REMOTEKEY))
static_remotekey_start = 0;
else
static_remotekey_start = 0x7FFFFFFFFFFFFFFF;
option_anchor_outputs
= feature_negotiated(ld->our_features,
uc->peer->their_features,
OPT_ANCHOR_OUTPUTS);
channel = new_channel(uc->peer, uc->dbid,
NULL, /* No shachain yet */
CHANNELD_AWAITING_LOCKIN,
@@ -221,7 +216,7 @@ wallet_commit_channel(struct lightningd *ld,
ld->config.fee_per_satoshi,
remote_upfront_shutdown_script,
static_remotekey_start, static_remotekey_start,
option_anchor_outputs,
type,
NUM_SIDES, /* closer not yet known */
uc->fc ? REASON_USER : REASON_REMOTE,
NULL,