@@ -393,6 +393,10 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
393
393
struct channel * channel = tal (peer -> ld , struct channel );
394
394
struct amount_msat htlc_min , htlc_max ;
395
395
396
+ bool anysegwit = !chainparams -> is_elements && feature_negotiated (peer -> ld -> our_features ,
397
+ peer -> their_features ,
398
+ OPT_SHUTDOWN_ANYSEGWIT );
399
+
396
400
assert (dbid != 0 );
397
401
channel -> peer = peer ;
398
402
channel -> dbid = dbid ;
@@ -469,7 +473,7 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
469
473
if (local_shutdown_scriptpubkey ) {
470
474
channel -> shutdown_scriptpubkey [LOCAL ]
471
475
= tal_steal (channel , local_shutdown_scriptpubkey );
472
- } else if (! chainparams -> is_elements && channel_type_has ( type , OPT_SHUTDOWN_ANYSEGWIT ) ) {
476
+ } else if (anysegwit ) {
473
477
channel -> shutdown_scriptpubkey [LOCAL ]
474
478
= p2tr_for_keyidx (channel , channel -> peer -> ld ,
475
479
channel -> final_key_idx );
@@ -529,7 +533,7 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
529
533
530
534
/* Make sure we see any spends using this key */
531
535
if (!local_shutdown_scriptpubkey ) {
532
- if (! chainparams -> is_elements && channel_type_has ( type , OPT_SHUTDOWN_ANYSEGWIT ) ) {
536
+ if (anysegwit ) {
533
537
txfilter_add_scriptpubkey (peer -> ld -> owned_txfilter ,
534
538
take (p2tr_for_keyidx (NULL , peer -> ld ,
535
539
channel -> final_key_idx )));
0 commit comments