MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_reconnect_openingd

Function test_reconnect_openingd

tests/test_connection.py:685–718  ·  view source on GitHub ↗
(node_factory)

Source from the content-addressed store, hash-verified

683@pytest.mark.openchannel('v1')
684@pytest.mark.openchannel('v2')
685def test_reconnect_openingd(node_factory):
686 # Openingd thinks we're still opening; opener reconnects..
687 disconnects = ['0WIRE_ACCEPT_CHANNEL']
688
689 if EXPERIMENTAL_DUAL_FUND:
690 disconnects = ['0WIRE_ACCEPT_CHANNEL2']
691
692 l1 = node_factory.get_node(may_reconnect=True)
693 l2 = node_factory.get_node(disconnect=disconnects,
694 may_reconnect=True)
695 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
696
697 l1.fundwallet(2000000)
698
699 # l2 closes on l1, l1 forgets.
700 with pytest.raises(RpcError):
701 l1.rpc.fundchannel(l2.info['id'], CHANNEL_SIZE)
702 assert l1.rpc.getpeer(l2.info['id']) is None
703
704 # Reconnect.
705 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
706
707 # We should get a message about reconnecting.
708 l2.daemon.wait_for_log('Killing opening daemon: Reconnected')
709 l2.daemon.wait_for_log('Handed peer, entering loop')
710
711 # Should work fine.
712 l1.rpc.fundchannel(l2.info['id'], CHANNEL_SIZE)
713 l1.daemon.wait_for_log('sendrawtx exit 0')
714
715 l1.bitcoin.generate_block(3)
716
717 # Just to be sure, second openingd hand over to channeld. This log line is about channeld being started
718 l2.daemon.wait_for_log(r'channeld-chan#[0-9]: pid [0-9]+, msgfd [0-9]+')
719
720
721@pytest.mark.skip('needs blackhold support')

Callers

nothing calls this directly

Calls 7

fundwalletMethod · 0.80
wait_for_logMethod · 0.80
generate_blockMethod · 0.80
get_nodeMethod · 0.45
connectMethod · 0.45
fundchannelMethod · 0.45
getpeerMethod · 0.45

Tested by

no test coverage detected