Tiny payment, huge fee l1 -> l2 -> l3 Create a tiny invoice for 1 msat, it'll be dominated by the base_fee on the l2->l3 channel. So it'll get rejected on the first attempt if we set the exemptfee way too low. The default fee exemption threshold is 5000msat, so 5001msat is not
(node_factory)
| 3840 | |
| 3841 | |
| 3842 | def test_pay_exemptfee(node_factory): |
| 3843 | """Tiny payment, huge fee |
| 3844 | |
| 3845 | l1 -> l2 -> l3 |
| 3846 | |
| 3847 | Create a tiny invoice for 1 msat, it'll be dominated by the base_fee on |
| 3848 | the l2->l3 channel. So it'll get rejected on the first attempt if we set |
| 3849 | the exemptfee way too low. The default fee exemption threshold is |
| 3850 | 5000msat, so 5001msat is not exempted by default and a 5001msat fee on |
| 3851 | l2->l3 should trigger this. |
| 3852 | |
| 3853 | """ |
| 3854 | l1, l2, l3 = node_factory.line_graph( |
| 3855 | 3, |
| 3856 | opts=[{}, {'fee-base': 5001, 'fee-per-satoshi': 0}, {}], |
| 3857 | wait_for_announce=True |
| 3858 | ) |
| 3859 | |
| 3860 | err = r'Could not find route without excessive cost' |
| 3861 | |
| 3862 | with pytest.raises(RpcError, match=err): |
| 3863 | l1.dev_pay(l3.rpc.invoice(1, "lbl1", "desc")['bolt11'], dev_use_shadow=False) |
| 3864 | |
| 3865 | # If we tell our node that 5001msat is ok this should work |
| 3866 | l1.dev_pay(l3.rpc.invoice(1, "lbl2", "desc")['bolt11'], dev_use_shadow=False, exemptfee=5001) |
| 3867 | |
| 3868 | # Given the above network this is the smallest amount that passes without |
| 3869 | # the fee-exemption (notice that we let it through on equality). |
| 3870 | threshold = int(5001 / 0.05) |
| 3871 | |
| 3872 | # This should be just below the fee-exemption and is the first value that is allowed through |
| 3873 | with pytest.raises(RpcError, match=err): |
| 3874 | l1.dev_pay(l3.rpc.invoice(threshold - 1, "lbl3", "desc")['bolt11'], dev_use_shadow=False) |
| 3875 | |
| 3876 | # While this'll work just fine |
| 3877 | l1.dev_pay(l3.rpc.invoice(int(5001 * 200), "lbl4", "desc")['bolt11'], dev_use_shadow=False) |
| 3878 | |
| 3879 | |
| 3880 | def test_pay_peer(node_factory, bitcoind): |
nothing calls this directly
no test coverage detected