Ensure that we can use zeroconf channels in forwards. Test that we add routehints using the zeroconf channel, and then ensure that l2 uses the alias from the routehint to forward the payment. Then do the inverse by sending from l3 to l1, first hop being the zeroconf channel
(node_factory, bitcoind)
| 2413 | |
| 2414 | |
| 2415 | def test_zeroconf_forward(node_factory, bitcoind): |
| 2416 | """Ensure that we can use zeroconf channels in forwards. |
| 2417 | |
| 2418 | Test that we add routehints using the zeroconf channel, and then |
| 2419 | ensure that l2 uses the alias from the routehint to forward the |
| 2420 | payment. Then do the inverse by sending from l3 to l1, first hop |
| 2421 | being the zeroconf channel |
| 2422 | |
| 2423 | """ |
| 2424 | plugin_path = Path(__file__).parent / "plugins" / "zeroconf-selective.py" |
| 2425 | opts = [ |
| 2426 | {}, |
| 2427 | {}, |
| 2428 | { |
| 2429 | 'plugin': str(plugin_path), |
| 2430 | 'zeroconf_allow': '033845802d25b4e074ccfd7cd8b339a41dc75bf9978a034800444b51d42b07799a' |
| 2431 | } |
| 2432 | ] |
| 2433 | l1, l2, l3 = node_factory.get_nodes(3, opts=opts) |
| 2434 | |
| 2435 | l1.connect(l2) |
| 2436 | l1.fundchannel(l2, 10**6) |
| 2437 | bitcoind.generate_block(6) |
| 2438 | |
| 2439 | l2.connect(l3) |
| 2440 | l2.fundwallet(10**7) |
| 2441 | l2.rpc.fundchannel(l3.info['id'], 10**6, mindepth=0) |
| 2442 | wait_for(lambda: l3.rpc.listincoming()['incoming'] != []) |
| 2443 | wait_for(lambda: only_one(l3.rpc.listincoming()['incoming'])['incoming_capacity_msat'] != 0) |
| 2444 | |
| 2445 | # Make sure (esp in non-dev-mode) blockheights agree so we don't WIRE_EXPIRY_TOO_SOON... |
| 2446 | sync_blockheight(bitcoind, [l1, l2, l3]) |
| 2447 | inv = l3.rpc.invoice(42 * 10**6, 'inv1', 'desc')['bolt11'] |
| 2448 | l1.rpc.xpay(inv) |
| 2449 | |
| 2450 | # And now try the other way around: zeroconf channel first |
| 2451 | # followed by a public one. |
| 2452 | # Make sure it l3 sees l1->l2 |
| 2453 | wait_for(lambda: len(l3.rpc.listchannels(source=l1.info['id'])['channels']) == 1) |
| 2454 | |
| 2455 | # Make sure all htlcs completely settled! |
| 2456 | wait_for(lambda: (p['htlcs'] == [] for p in l2.rpc.listpeerchannels()['channels'])) |
| 2457 | |
| 2458 | inv = l1.rpc.invoice(42, 'back1', 'desc')['bolt11'] |
| 2459 | l3.rpc.xpay(inv) |
| 2460 | |
| 2461 | |
| 2462 | def test_zeroconf_refusal(bitcoind, node_factory, chainparams): |
nothing calls this directly
no test coverage detected