From da34c369f33189d2457bbc7987bcdf1d4351e5e4 Mon Sep 17 00:00:00 2001 From: niftynei Date: Tue, 31 Oct 2023 14:52:19 -0500 Subject: [PATCH] dualfund, tests: break out "peer forgets" test Now that we save the commitment sigs immediately, we have to drop the connection elsewhere in the flow to get the state where only one peer remembers. --- tests/test_connection.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/tests/test_connection.py b/tests/test_connection.py index a7db6cdb0..570faaa54 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -622,13 +622,10 @@ def test_disconnect_fundee_v2(node_factory): @pytest.mark.openchannel('v1') -@pytest.mark.openchannel('v2') def test_disconnect_half_signed(node_factory): # Now, these are the corner cases. Fundee sends funding_signed, # but opener doesn't receive it. disconnects = ['-WIRE_FUNDING_SIGNED'] - if EXPERIMENTAL_DUAL_FUND: - disconnects = ['-WIRE_COMMITMENT_SIGNED'] l1 = node_factory.get_node() l2 = node_factory.get_node(disconnect=disconnects) @@ -643,6 +640,26 @@ def test_disconnect_half_signed(node_factory): assert len(l2.rpc.listpeerchannels(l1.info['id'])['channels']) == 1 +@pytest.mark.openchannel('v2') +def test_disconnect_half_signed_v2(node_factory): + # Now, these are the corner cases. + # L1 remembers the channel, L2 doesn't + disconnects = ['-WIRE_TX_COMPLETE'] + l1 = node_factory.get_node(disconnect=disconnects) + l2 = node_factory.get_node() + + l1.fundwallet(2000000) + + l1.rpc.connect(l2.info['id'], 'localhost', l2.port) + with pytest.raises(RpcError): + l1.rpc.fundchannel(l2.info['id'], CHANNEL_SIZE) + + # Opener remembers, peer doesn't. + wait_for(lambda: l2.rpc.listpeers(l1.info['id'])['peers'] == []) + wait_for(lambda: only_one(l1.rpc.listpeers(l2.info['id'])['peers'])['connected'] is False) + assert len(l1.rpc.listpeerchannels(l2.info['id'])['channels']) == 1 + + @pytest.mark.openchannel('v1') @pytest.mark.openchannel('v2') def test_reconnect_signed(node_factory):