mirror of
https://github.com/ElementsProject/lightning.git
synced 2026-08-19 13:17:42 +02:00
lightningd: make sure we register all addresses at opening if peer doesn't support OPT_SHUTDOWN_ANYSEGWIT.
We select the close key index at opening time, but the non-DF code didn't correctly register the address as possibly used for P2WPKH for older nodes. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Fixed: wallet: we could miss our own returned outputs on mutual closes if peer doesn't support option_shutdown_anysegwit (you will still need to rescan after update, if this happened to you!) Reported-by: Grubles
This commit is contained in:
parent
46690cb2a6
commit
d40da2b671
2 changed files with 7 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue