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

Function test_max_channel_id

tests/test_db.py:105–134  ·  view source on GitHub ↗
(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

103# Test that the max-channel-id is set correctly between
104# restarts (with forgotten channel)
105def test_max_channel_id(node_factory, bitcoind):
106 # Create a channel between two peers.
107 # Close the channel and have 100 blocks happen (forget channel)
108 # Restart node, create channel again. Should succeed.
109 l1, l2 = node_factory.line_graph(2, fundchannel=True, wait_for_announce=True)
110 sync_blockheight(bitcoind, [l1, l2])
111
112 # Now shutdown cleanly.
113 l1.rpc.close(l2.info['id'], 0)
114
115 l1.daemon.wait_for_log(' to CLOSINGD_COMPLETE')
116 l2.daemon.wait_for_log(' to CLOSINGD_COMPLETE')
117
118 # And should put closing into mempool.
119 l1.wait_for_channel_onchain(l2.info['id'])
120 l2.wait_for_channel_onchain(l1.info['id'])
121
122 bitcoind.generate_block(101)
123 wait_for(lambda: l1.rpc.listpeerchannels()['channels'] == [])
124 wait_for(lambda: l2.rpc.listpeerchannels()['channels'] == [])
125
126 # Stop l2, and restart
127 l2.stop()
128 l2.start()
129
130 # Reconnect
131 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
132
133 # Fundchannel again, should succeed.
134 l1.rpc.fundchannel(l2.info['id'], 10**5)
135
136
137@unittest.skipIf(not COMPAT, "needs COMPAT to convert obsolete db")

Callers

nothing calls this directly

Calls 12

sync_blockheightFunction · 0.90
wait_forFunction · 0.90
line_graphMethod · 0.80
wait_for_logMethod · 0.80
generate_blockMethod · 0.80
listpeerchannelsMethod · 0.80
closeMethod · 0.45
stopMethod · 0.45
startMethod · 0.45
connectMethod · 0.45
fundchannelMethod · 0.45

Tested by

no test coverage detected