The freedom to choose the forward channel bytes us when it is 0conf Reported by Breez, we crashed when logging in `forward_htlc` when the replacement channel was a zeroconf channel. l2 -> l3 is a double channel with the zeroconf channel having a higher spendable msat, which should
(node_factory)
| 2687 | |
| 2688 | |
| 2689 | def test_zeroconf_multichan_forward(node_factory): |
| 2690 | """The freedom to choose the forward channel bytes us when it is 0conf |
| 2691 | |
| 2692 | Reported by Breez, we crashed when logging in `forward_htlc` when |
| 2693 | the replacement channel was a zeroconf channel. |
| 2694 | |
| 2695 | l2 -> l3 is a double channel with the zeroconf channel having a |
| 2696 | higher spendable msat, which should cause it to be chosen instead. |
| 2697 | |
| 2698 | """ |
| 2699 | node_id = '033845802d25b4e074ccfd7cd8b339a41dc75bf9978a034800444b51d42b07799a' |
| 2700 | plugin_path = Path(__file__).parent / "plugins" / "zeroconf-selective.py" |
| 2701 | l1, l2, l3 = node_factory.line_graph(3, opts=[ |
| 2702 | {}, |
| 2703 | {}, |
| 2704 | { |
| 2705 | 'plugin': str(plugin_path), |
| 2706 | 'zeroconf_allow': node_id, |
| 2707 | } |
| 2708 | ], fundamount=10**6, wait_for_announce=True) |
| 2709 | |
| 2710 | # Just making sure the allowlisted node_id matches. |
| 2711 | assert l2.info['id'] == node_id |
| 2712 | |
| 2713 | # Create invoice which doesn't use zeroconf channel as routehint! |
| 2714 | inv = l3.rpc.invoice(amount_msat=10000, label='lbl1', description='desc')['bolt11'] |
| 2715 | |
| 2716 | # Now create a channel that is twice as large as the real channel, |
| 2717 | # and don't announce it. |
| 2718 | l2.fundwallet(10**7) |
| 2719 | zeroconf_cid = l2.rpc.fundchannel(l3.info['id'], 2 * 10**6, mindepth=0)['channel_id'] |
| 2720 | |
| 2721 | l2.daemon.wait_for_log(r'peer_in WIRE_CHANNEL_READY') |
| 2722 | l3.daemon.wait_for_log(r'peer_in WIRE_CHANNEL_READY') |
| 2723 | |
| 2724 | l1.rpc.xpay(inv) |
| 2725 | |
| 2726 | for c in l2.rpc.listpeerchannels(l3.info['id'])['channels']: |
| 2727 | if c['channel_id'] == zeroconf_cid: |
| 2728 | zeroconf_scid = c['alias']['local'] |
| 2729 | else: |
| 2730 | normal_scid = c['short_channel_id'] |
| 2731 | |
| 2732 | assert l2.daemon.is_in_log(r'Chose a better channel than {}: {}' |
| 2733 | .format(normal_scid, zeroconf_scid)) |
| 2734 | |
| 2735 | |
| 2736 | def test_zeroreserve(node_factory, bitcoind): |
nothing calls this directly
no test coverage detected