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

Function test_reconnect_no_update

tests/test_connection.py:741–780  ·  view source on GitHub ↗

Test that channel_ready is retransmitted on reconnect if new channel This tests if the `channel_ready` is sent if we receive a `channel_reestablish` message with `next_commitment_number` == 1 and our `next_commitment_number` == 1. This test makes extensive use of disconnects follow

(node_factory, executor, bitcoind)

Source from the content-addressed store, hash-verified

739@pytest.mark.openchannel('v1')
740@pytest.mark.openchannel('v2')
741def test_reconnect_no_update(node_factory, executor, bitcoind):
742 """Test that channel_ready is retransmitted on reconnect if new channel
743
744 This tests if the `channel_ready` is sent if we receive a
745 `channel_reestablish` message with `next_commitment_number` == 1
746 and our `next_commitment_number` == 1.
747
748 This test makes extensive use of disconnects followed by automatic
749 reconnects. See comments for details.
750
751 """
752 disconnects = ["-WIRE_CHANNEL_READY", "-WIRE_SHUTDOWN"]
753 # Allow bad gossip because it might receive WIRE_CHANNEL_UPDATE before
754 # announcement of the disconnection
755 l1 = node_factory.get_node(may_reconnect=True, allow_bad_gossip=True)
756 l2 = node_factory.get_node(disconnect=disconnects, may_reconnect=True)
757
758 # For channeld reconnection
759 l1.rpc.connect(l2.info["id"], "localhost", l2.port)
760
761 # LightningNode.fundchannel will fund the channel and generate a
762 # block. The block triggers the channel_ready message, which
763 # causes a disconnect. The retransmission is then caused by the
764 # automatic retry.
765 fundchannel_exec = executor.submit(l1.fundchannel, l2, 10**6, False)
766 if l1.config('experimental-dual-fund'):
767 l1.daemon.wait_for_log(r"dualopend.* Retransmitting channel_ready for channel")
768 else:
769 l1.daemon.wait_for_log(r"channeld.* Retransmitting channel_ready for channel")
770 sync_blockheight(bitcoind, [l1, l2])
771 fundchannel_exec.result()
772 l1.stop()
773
774 # For closingd reconnection
775 l1.daemon.start()
776 # Close will trigger the -WIRE_SHUTDOWN and we then wait for the
777 # automatic reconnection to trigger the retransmission.
778 l1.rpc.close(l2.info['id'], 0)
779 l2.daemon.wait_for_log(r"channeld.* Retransmitting channel_ready for channel")
780 l1.daemon.wait_for_log(r"CLOSINGD_COMPLETE")
781
782
783@pytest.mark.openchannel('v1')

Callers

nothing calls this directly

Calls 8

sync_blockheightFunction · 0.90
configMethod · 0.80
wait_for_logMethod · 0.80
get_nodeMethod · 0.45
connectMethod · 0.45
stopMethod · 0.45
startMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected