Skip to content

pytest: fix flake in test_anchorspend_using_to_remote #8343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions tests/test_closing.py
Original file line number Diff line number Diff line change
@@ -4165,7 +4165,10 @@ def test_closing_ignore_fee_limits(node_factory, bitcoind, executor):
def test_anchorspend_using_to_remote(node_factory, bitcoind, anchors):
"""Make sure we can use `to_remote` output of previous close to spend anchor"""
# Try with old output from both anchor and non-anchor channel.
l4_opts = {}

# We want l2 to process the WIRE_UPDATE_FULFILL_HTLC, so l4 drops
# on WIRE_REVOKE_AND_ACK after that.
l4_opts = {'disconnect': ['-WIRE_REVOKE_AND_ACK*2']}
if anchors is False:
l4_opts['dev-force-features'] = "-23"

@@ -4178,11 +4181,12 @@ def test_anchorspend_using_to_remote(node_factory, bitcoind, anchors):
# this to use anchor.
node_factory.join_nodes([l4, l2])

# l4 unilaterally closes, l2 gets to-remote with its output.
# l4 disconnects after receiving fulfill. It then unilaterally
# closes, l2 gets to-remote with its output.
l4.rpc.pay(l2.rpc.invoice(100000000, 'test', 'test')['bolt11'])
wait_for(lambda: only_one(l4.rpc.listpeerchannels()['channels'])['htlcs'] != [])

l4.rpc.disconnect(l2.info['id'], force=True)
wait_for(lambda: only_one(l4.rpc.listpeers()['peers'])['connected'] is False)
close = l4.rpc.close(l2.info['id'], 1)
bitcoind.generate_block(1, wait_for_mempool=only_one(close['txids']))
wait_for(lambda: len(l2.rpc.listfunds()['outputs']) == 1)