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

Function test_shutdown_awaiting_lockin

tests/test_connection.py:940–974  ·  view source on GitHub ↗
(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

938@pytest.mark.openchannel('v1')
939@pytest.mark.openchannel('v2')
940def test_shutdown_awaiting_lockin(node_factory, bitcoind):
941 l1 = node_factory.get_node()
942 l2 = node_factory.get_node(options={'funding-confirms': 3})
943
944 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
945 l1.fundwallet(10**6 + 1000000)
946 chanid = l1.rpc.fundchannel(l2.info['id'], 10**6)['channel_id']
947
948 # Technically, this is async to fundchannel.
949 bitcoind.generate_block(1, wait_for_mempool=1)
950
951 l1.rpc.close(chanid)
952
953 l1_state = 'DUALOPEND' if l1.config('experimental-dual-fund') else 'CHANNELD'
954 l2_state = 'DUALOPEND' if l1.config('experimental-dual-fund') else 'CHANNELD'
955 l1.daemon.wait_for_log('{}_AWAITING_LOCKIN to CHANNELD_SHUTTING_DOWN'.format(l1_state))
956 l2.daemon.wait_for_log('{}_AWAITING_LOCKIN to CHANNELD_SHUTTING_DOWN'.format(l2_state))
957
958 l1.daemon.wait_for_log('CHANNELD_SHUTTING_DOWN to CLOSINGD_SIGEXCHANGE')
959 l2.daemon.wait_for_log('CHANNELD_SHUTTING_DOWN to CLOSINGD_SIGEXCHANGE')
960
961 # And should put closing into mempool (happens async, so
962 # CLOSINGD_COMPLETE may come first).
963 l1.daemon.wait_for_logs(['sendrawtx exit 0', ' to CLOSINGD_COMPLETE'])
964 l2.daemon.wait_for_logs(['sendrawtx exit 0', ' to CLOSINGD_COMPLETE'])
965
966 bitcoind.generate_block(1, wait_for_mempool=1)
967 l1.daemon.wait_for_log(' to ONCHAIN')
968 l2.daemon.wait_for_log(' to ONCHAIN')
969
970 bitcoind.generate_block(100)
971
972 # Won't disconnect!
973 wait_for(lambda: only_one(l1.rpc.listpeers()['peers'])['channels'] == [])
974 wait_for(lambda: only_one(l2.rpc.listpeers()['peers'])['channels'] == [])
975
976
977@pytest.mark.openchannel('v1')

Callers

nothing calls this directly

Calls 12

wait_forFunction · 0.90
only_oneFunction · 0.90
fundwalletMethod · 0.80
generate_blockMethod · 0.80
configMethod · 0.80
wait_for_logMethod · 0.80
wait_for_logsMethod · 0.80
get_nodeMethod · 0.45
connectMethod · 0.45
fundchannelMethod · 0.45
closeMethod · 0.45
listpeersMethod · 0.45

Tested by

no test coverage detected