Skip to content

Commit 1c203aa

Browse files
committed
Check for negotiated feature ANYSEGWIT, not channel features
1 parent e39f019 commit 1c203aa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lightningd/channel.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,10 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
393393
struct channel *channel = tal(peer->ld, struct channel);
394394
struct amount_msat htlc_min, htlc_max;
395395

396+
bool anysegwit = !chainparams->is_elements && feature_negotiated(peer->ld->our_features,
397+
peer->their_features,
398+
OPT_SHUTDOWN_ANYSEGWIT);
399+
396400
assert(dbid != 0);
397401
channel->peer = peer;
398402
channel->dbid = dbid;
@@ -469,7 +473,7 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
469473
if (local_shutdown_scriptpubkey) {
470474
channel->shutdown_scriptpubkey[LOCAL]
471475
= tal_steal(channel, local_shutdown_scriptpubkey);
472-
} else if (!chainparams->is_elements && channel_type_has(type, OPT_SHUTDOWN_ANYSEGWIT)) {
476+
} else if (anysegwit) {
473477
channel->shutdown_scriptpubkey[LOCAL]
474478
= p2tr_for_keyidx(channel, channel->peer->ld,
475479
channel->final_key_idx);
@@ -529,7 +533,7 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
529533

530534
/* Make sure we see any spends using this key */
531535
if (!local_shutdown_scriptpubkey) {
532-
if (!chainparams->is_elements && channel_type_has(type, OPT_SHUTDOWN_ANYSEGWIT)) {
536+
if (anysegwit) {
533537
txfilter_add_scriptpubkey(peer->ld->owned_txfilter,
534538
take(p2tr_for_keyidx(NULL, peer->ld,
535539
channel->final_key_idx)));

0 commit comments

Comments
 (0)