Test that we transition correctly from zeroconf to public The differences being that a public channel MUST use the public scid. l1 and l2 open a zeroconf channel, then l3 learns about it after 6 confirmations.
(bitcoind, node_factory, chainparams)
| 2311 | |
| 2312 | |
| 2313 | def test_zeroconf_public(bitcoind, node_factory, chainparams): |
| 2314 | """Test that we transition correctly from zeroconf to public |
| 2315 | |
| 2316 | The differences being that a public channel MUST use the public |
| 2317 | scid. l1 and l2 open a zeroconf channel, then l3 learns about it |
| 2318 | after 6 confirmations. |
| 2319 | |
| 2320 | """ |
| 2321 | plugin_path = Path(__file__).parent / "plugins" / "zeroconf-selective.py" |
| 2322 | coin_mvt_plugin = Path(__file__).parent / "plugins" / "coin_movements.py" |
| 2323 | |
| 2324 | l1, l2, l3 = node_factory.get_nodes(3, opts=[ |
| 2325 | {'plugin': str(coin_mvt_plugin)}, |
| 2326 | { |
| 2327 | 'plugin': str(plugin_path), |
| 2328 | 'zeroconf_allow': '038194b5f32bdf0aa59812c86c4ef7ad2f294104fa027d1ace9b469bb6f88cf37b' |
| 2329 | }, |
| 2330 | {} |
| 2331 | ]) |
| 2332 | # Advances blockheight to 102 |
| 2333 | l1.fundwallet(10**6) |
| 2334 | push_msat = 20000 * 1000 |
| 2335 | l1.connect(l2) |
| 2336 | l1.rpc.fundchannel(l2.info['id'], 'all', mindepth=0, push_msat=push_msat) |
| 2337 | |
| 2338 | # Wait for the alias to be sent to peer. |
| 2339 | wait_for(lambda: 'remote' in only_one(l1.rpc.listpeerchannels()['channels'])['updates']) |
| 2340 | wait_for(lambda: 'remote' in only_one(l2.rpc.listpeerchannels()['channels'])['updates']) |
| 2341 | |
| 2342 | l1chan = only_one(l1.rpc.listpeerchannels()['channels']) |
| 2343 | l2chan = only_one(l2.rpc.listpeerchannels()['channels']) |
| 2344 | channel_id = l1chan['channel_id'] |
| 2345 | |
| 2346 | # We have no confirmation yet, so no `short_channel_id` |
| 2347 | assert('short_channel_id' not in l1chan) |
| 2348 | assert('short_channel_id' not in l2chan) |
| 2349 | |
| 2350 | # Channel is "proposed" |
| 2351 | chan_val = 993888000 if chainparams['elements'] else 970073000 |
| 2352 | l1_mvts = [ |
| 2353 | {'type': 'chain_mvt', 'credit_msat': chan_val, 'debit_msat': 0, 'tags': ['channel_proposed', 'opener']}, |
| 2354 | {'type': 'channel_mvt', 'credit_msat': 0, 'debit_msat': 20000000, 'tags': ['pushed'], 'fees_msat': '0msat'}, |
| 2355 | ] |
| 2356 | check_coin_moves(l1, l1chan['channel_id'], l1_mvts, chainparams) |
| 2357 | |
| 2358 | # Check that the channel_open event has blockheight of zero |
| 2359 | for n in [l1, l2]: |
| 2360 | evs = n.rpc.bkpr_listaccountevents(channel_id)['events'] |
| 2361 | open_ev = only_one([e for e in evs if e['tag'] == 'channel_proposed']) |
| 2362 | assert open_ev['blockheight'] == 0 |
| 2363 | |
| 2364 | # Call inspect, should have pending event in it |
| 2365 | tx = only_one(n.rpc.bkpr_inspect(channel_id)['txs']) |
| 2366 | assert 'blockheight' not in tx |
| 2367 | assert only_one(tx['outputs'])['output_tag'] == 'channel_proposed' |
| 2368 | |
| 2369 | # Now add 1 confirmation, we should get a `short_channel_id` (block 103) |
| 2370 | bitcoind.generate_block(1) |
nothing calls this directly
no test coverage detected