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

Function test_closing_id

tests/test_closing.py:180–202  ·  view source on GitHub ↗

Test closing using peer ID and full channel ID

(node_factory)

Source from the content-addressed store, hash-verified

178
179
180def test_closing_id(node_factory):
181 """Test closing using peer ID and full channel ID
182 """
183 l1, l2 = node_factory.get_nodes(2)
184
185 # Close by full channel ID.
186 l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
187 l1.fundchannel(l2, 10**6)
188 cid = l2.rpc.listpeerchannels()['channels'][0]['channel_id']
189 l2.rpc.close(cid)
190 # Technically, l2 disconnects before l1 finishes analyzing the final msg.
191 # Wait for them to both consider it closed!
192 wait_for(lambda: any([c['state'] == 'CLOSINGD_COMPLETE' for c in l1.rpc.listpeerchannels(l2.info['id'])['channels']]))
193 wait_for(lambda: any([c['state'] == 'CLOSINGD_COMPLETE' for c in l2.rpc.listpeerchannels(l1.info['id'])['channels']]))
194
195 # Close by peer ID.
196 l2.rpc.connect(l1.info['id'], 'localhost', l1.port)
197 l1.daemon.wait_for_log("Handed peer, entering loop")
198 l2.fundchannel(l1, 10**6)
199 pid = l1.info['id']
200 l2.rpc.close(pid)
201 wait_for(lambda: any([c['state'] == 'CLOSINGD_COMPLETE' for c in l1.rpc.listpeerchannels(l2.info['id'])['channels']]))
202 wait_for(lambda: any([c['state'] == 'CLOSINGD_COMPLETE' for c in l2.rpc.listpeerchannels(l1.info['id'])['channels']]))
203
204
205@unittest.skipIf(TEST_NETWORK != 'regtest', 'FIXME: broken under elements')

Callers

nothing calls this directly

Calls 8

wait_forFunction · 0.90
get_nodesMethod · 0.80
listpeerchannelsMethod · 0.80
wait_for_logMethod · 0.80
anyClass · 0.50
connectMethod · 0.45
fundchannelMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected