Skip to content

Commit 44ed1bc

Browse files
committed
pytest: really fix flake in test_reconnect_signed
``` > l1.rpc.fundchannel(l2.info['id'], CHANNEL_SIZE) tests/test_connection.py:667: ... > raise RpcError(method, payload, resp['error']) E pyln.client.lightning.RpcError: RPC call failed: method: fundchannel, payload: {'id': '022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59', 'amount': 50000, 'announce': True}, error: {'code': -1, 'message': 'Disconnected', 'data': {'id': '022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59', 'method': 'openchannel_update'}} ``` What happens here is complicated. 1. dualopend never processes the WIRE_COMMITMENT_SIGNED message, meaning it doesn't consider it worth trying to reconnect. 2. Normally, on disconnect, we give subds time to process packets and then notice the disconnect. 3. But, if we can another connection, we terminate the (old) subds immediately. 4. When lightningd transitions the channel from DUALOPEND_OPEN_INIT to DUALOPEND_OPEN_COMMIT_READY, it tells connectd this peer is important. 5. Normally, this causes a reconnect one second after hangup. 6. However, if we've already disconnected, it makes connectd reconnect immediately. This causes the test flake, if dualopend hasn't processed the message, and thus changed the state to DUALOPEND_OPEN_COMMITTED: we don't reconnect and instead fail the fundchannel() call. Signed-off-by: Rusty Russell <[email protected]>
1 parent 3e67915 commit 44ed1bc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests/test_connection.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -654,12 +654,13 @@ def test_disconnect_half_signed_v2(node_factory):
654654
@pytest.mark.openchannel('v2')
655655
def test_reconnect_signed(node_factory):
656656
# This will fail *after* both sides consider channel opening.
657-
disconnects = ['<WIRE_FUNDING_SIGNED']
658657
if EXPERIMENTAL_DUAL_FUND:
659-
disconnects = ['<WIRE_COMMITMENT_SIGNED']
660-
661-
l1 = node_factory.get_node(may_reconnect=True, disconnect=disconnects)
662-
l2 = node_factory.get_node(may_reconnect=True)
658+
# Definitely in DUALOPEND_OPEN_COMMITTED once it's trying to send this.
659+
l1 = node_factory.get_node(may_reconnect=True)
660+
l2 = node_factory.get_node(may_reconnect=True, disconnect=['-WIRE_TX_SIGNATURES'])
661+
else:
662+
l1 = node_factory.get_node(may_reconnect=True, disconnect=['<WIRE_FUNDING_SIGNED'])
663+
l2 = node_factory.get_node(may_reconnect=True)
663664

664665
l1.fundwallet(2000000)
665666

0 commit comments

Comments
 (0)