(node_factory, executor)
| 5828 | @pytest.mark.openchannel('v1') |
| 5829 | @pytest.mark.openchannel('v2') |
| 5830 | def test_pay_partial_msat(node_factory, executor): |
| 5831 | l1, l2, l3 = node_factory.line_graph(3, |
| 5832 | opts={'xpay-handle-pay': False, |
| 5833 | 'allow-deprecated-apis': True}) |
| 5834 | |
| 5835 | inv = l3.rpc.invoice(100000000, "inv", "inv") |
| 5836 | |
| 5837 | with pytest.raises(RpcError, match="partial_msat must be less or equal to total amount 10000000"): |
| 5838 | l2.rpc.pay(inv['bolt11'], partial_msat=100000001) |
| 5839 | |
| 5840 | # This will fail with an MPP timeout. |
| 5841 | with pytest.raises(RpcError, match="failed: WIRE_MPP_TIMEOUT"): |
| 5842 | l2.rpc.pay(inv['bolt11'], partial_msat=90000000) |
| 5843 | |
| 5844 | # This will work like normal. |
| 5845 | l2.rpc.pay(inv['bolt11'], partial_msat=100000000) |
| 5846 | |
| 5847 | # Make sure l3 can pay to l2 now. |
| 5848 | wait_for(lambda: only_one(l3.rpc.listpeerchannels()['channels'])['spendable_msat'] > 1001) |
| 5849 | |
| 5850 | # Now we can combine together to pay l2: |
| 5851 | inv = l2.rpc.invoice('any', "inv", "inv") |
| 5852 | |
| 5853 | # If we specify different totals, this *won't work* |
| 5854 | l1pay = executor.submit(l1.rpc.pay, inv['bolt11'], amount_msat=10000, partial_msat=9000) |
| 5855 | l3pay = executor.submit(l3.rpc.pay, inv['bolt11'], amount_msat=10001, partial_msat=1001) |
| 5856 | |
| 5857 | # BOLT #4: |
| 5858 | # - SHOULD fail the entire HTLC set if `total_msat` is not |
| 5859 | # the same for all HTLCs in the set. |
| 5860 | with pytest.raises(RpcError, match="failed: WIRE_FINAL_INCORRECT_HTLC_AMOUNT"): |
| 5861 | l3pay.result(TIMEOUT) |
| 5862 | with pytest.raises(RpcError, match="failed: WIRE_FINAL_INCORRECT_HTLC_AMOUNT"): |
| 5863 | l1pay.result(TIMEOUT) |
| 5864 | |
| 5865 | # But same amount, will combine forces! |
| 5866 | l1pay = executor.submit(l1.rpc.pay, inv['bolt11'], amount_msat=10000, partial_msat=9000) |
| 5867 | l3pay = executor.submit(l3.rpc.pay, inv['bolt11'], amount_msat=10000, partial_msat=1000) |
| 5868 | |
| 5869 | l1pay.result(TIMEOUT) |
| 5870 | l3pay.result(TIMEOUT) |
| 5871 | |
| 5872 | |
| 5873 | def test_blindedpath_privchan(node_factory, bitcoind): |
nothing calls this directly
no test coverage detected