MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_xpay_slow_mode

Function test_xpay_slow_mode

tests/test_xpay.py:675–702  ·  view source on GitHub ↗
(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

673
674
675def test_xpay_slow_mode(node_factory, bitcoind):
676 # l1 -> l2 -> l3 -> l5
677 # \-> l4 -/^
678 l1, l2, l3, l4, l5 = node_factory.get_nodes(5, opts=[{'xpay-slow-mode': True},
679 {}, {}, {}, {}])
680 node_factory.join_nodes([l2, l3, l5])
681 node_factory.join_nodes([l2, l4, l5])
682
683 # Make sure l1 can see all paths.
684 node_factory.join_nodes([l1, l2])
685 bitcoind.generate_block(5)
686 wait_for(lambda: len(l1.rpc.listchannels()['channels']) == 10)
687
688 # First try an MPP which fails
689 inv = l5.rpc.invoice(800000000, 'test_xpay_slow_mode_fail', 'test_xpay_slow_mode_fail', preimage='01' * 32)['bolt11']
690 l5.rpc.delinvoice('test_xpay_slow_mode_fail', status='unpaid')
691
692 with pytest.raises(RpcError, match=r"Destination said it doesn't know invoice: incorrect_or_unknown_payment_details"):
693 l1.rpc.xpay(inv)
694
695 # Now a successful one
696 inv = l5.rpc.invoice(800000000, 'test_xpay_slow_mode', 'test_xpay_slow_mode', preimage='00' * 32)['bolt11']
697
698 assert l1.rpc.xpay(inv) == {'payment_preimage': '00' * 32,
699 'amount_msat': 800000000,
700 'amount_sent_msat': 800016004,
701 'failed_parts': 0,
702 'successful_parts': 2}
703
704
705@pytest.mark.parametrize("slow_mode", [False, True])

Callers

nothing calls this directly

Calls 8

wait_forFunction · 0.90
get_nodesMethod · 0.80
join_nodesMethod · 0.80
generate_blockMethod · 0.80
delinvoiceMethod · 0.80
listchannelsMethod · 0.45
invoiceMethod · 0.45
xpayMethod · 0.45

Tested by

no test coverage detected