diff --git a/lightningd/opening_control.c b/lightningd/opening_control.c index 372cad2f5..20461cba0 100644 --- a/lightningd/opening_control.c +++ b/lightningd/opening_control.c @@ -122,8 +122,14 @@ wallet_commit_channel(struct lightningd *ld, /* FIXME: P2TR for elements! */ if (chainparams->is_elements) addrtype = ADDR_BECH32; - else + else if (feature_negotiated(ld->our_features, + uc->peer->their_features, + OPT_SHUTDOWN_ANYSEGWIT)) addrtype = ADDR_P2TR; + else + /* They *may* update to OPT_SHUTDOWN_ANYSEGWIT by the + * time we close, so be prepared for both. */ + addrtype = ADDR_ALL; /* Get a key to use for closing outputs from this tx */ final_key_idx = wallet_get_newindex(ld, addrtype); diff --git a/tests/test_closing.py b/tests/test_closing.py index bd09de3ae..ac60117e7 100644 --- a/tests/test_closing.py +++ b/tests/test_closing.py @@ -4277,7 +4277,6 @@ def test_onchain_slow_anchor(node_factory, bitcoind): l1.daemon.wait_for_log(r"Low-priority anchorspend aiming for block {} \(feerate 7500\)".format(height + 12)) -@pytest.mark.xfail(strict=True) @unittest.skipIf(TEST_NETWORK != 'regtest', "elementsd doesn't use p2tr anyway") def test_onchain_close_no_p2tr(node_factory, bitcoind): """Closing with a peer which doesn't support OPT_SHUTDOWN_ANYSEGWIT"""