Test closing using peer ID and full channel ID
(node_factory)
| 178 | |
| 179 | |
| 180 | def 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') |
nothing calls this directly
no test coverage detected