Test whether we can deliver a keysend by adding layer (vs keyhint's routehints)
(node_factory)
| 3689 | |
| 3690 | |
| 3691 | def test_xkeysend_layer(node_factory): |
| 3692 | """Test whether we can deliver a keysend by adding layer (vs keyhint's routehints) |
| 3693 | """ |
| 3694 | amt = 10000 |
| 3695 | l1, l2 = node_factory.line_graph(2, wait_for_announce=True) |
| 3696 | l3 = node_factory.get_node() |
| 3697 | l2.connect(l3) |
| 3698 | l2.fundchannel(l3, announce_channel=False) |
| 3699 | |
| 3700 | dest = l3.info['id'] |
| 3701 | chan = only_one(l3.rpc.listpeerchannels()['channels']) |
| 3702 | l1.rpc.askrene_create_layer('test_xkeysend_layer1') |
| 3703 | l1.rpc.askrene_create_channel('test_xkeysend_layer1', |
| 3704 | l2.info['id'], |
| 3705 | dest, |
| 3706 | chan['alias']['remote'], |
| 3707 | '1000000sat') |
| 3708 | l1.rpc.askrene_update_channel(layer='test_xkeysend_layer1', |
| 3709 | short_channel_id_dir=f"{chan['alias']['remote']}/{chan['direction'] ^ 1}", |
| 3710 | htlc_minimum_msat=100, |
| 3711 | htlc_maximum_msat=900000000, |
| 3712 | fee_base_msat=1, |
| 3713 | fee_proportional_millionths=2, |
| 3714 | cltv_expiry_delta=18, |
| 3715 | enabled=True) |
| 3716 | |
| 3717 | # Dummy one |
| 3718 | l1.rpc.askrene_create_layer('test_xkeysend_layer2') |
| 3719 | l1.rpc.askrene_create_channel('test_xkeysend_layer2', |
| 3720 | l2.info['id'], |
| 3721 | '02' * 33, |
| 3722 | '1x2x3', |
| 3723 | '1000000sat') |
| 3724 | for scidd in ('1x2x3/0', '1x2x3/1'): |
| 3725 | l1.rpc.askrene_update_channel(layer='test_xkeysend_layer2', |
| 3726 | short_channel_id_dir=scidd, |
| 3727 | htlc_minimum_msat=100, |
| 3728 | htlc_maximum_msat=900000000, |
| 3729 | fee_base_msat=1, |
| 3730 | fee_proportional_millionths=2, |
| 3731 | cltv_expiry_delta=18, |
| 3732 | enabled=True) |
| 3733 | |
| 3734 | # Without any extra information we should fail: |
| 3735 | with pytest.raises(RpcError): |
| 3736 | l1.rpc.call("xkeysend", payload={'destination': dest, 'amount_msat': amt}) |
| 3737 | |
| 3738 | # We should also fail with only non-useful layers: |
| 3739 | with pytest.raises(RpcError): |
| 3740 | l1.rpc.call("xkeysend", payload={'destination': dest, 'amount_msat': amt, 'layers': ['test_xkeysend_layer2']}) |
| 3741 | |
| 3742 | l1.rpc.call("xkeysend", payload={'destination': dest, 'amount_msat': amt, 'layers': ['test_xkeysend_layer1', 'test_xkeysend_layer2']}) |
| 3743 | inv = only_one(l3.rpc.listinvoices()['invoices']) |
| 3744 | assert inv['amount_received_msat'] == amt |
| 3745 | |
| 3746 | |
| 3747 | @pytest.mark.parametrize("keysendcmd", ["keysend", "xkeysend"]) |
nothing calls this directly
no test coverage detected