Test the value randomization through shadow routing Note there is a very low (0.5**10) probability that it fails.
(node_factory)
| 2940 | |
| 2941 | |
| 2942 | def test_shadow_routing(node_factory): |
| 2943 | """ |
| 2944 | Test the value randomization through shadow routing |
| 2945 | |
| 2946 | Note there is a very low (0.5**10) probability that it fails. |
| 2947 | """ |
| 2948 | # We need l3 for random walk |
| 2949 | l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True) |
| 2950 | |
| 2951 | amount = 10000 |
| 2952 | total_amount = 0 |
| 2953 | n_payments = 10 |
| 2954 | for i in range(n_payments): |
| 2955 | inv = l3.rpc.invoice(amount, "{}".format(i), "test")["bolt11"] |
| 2956 | total_amount += l1.rpc.pay(inv)["amount_sent_msat"] |
| 2957 | |
| 2958 | assert total_amount > n_payments * amount |
| 2959 | # Test that the added amount isn't absurd |
| 2960 | assert total_amount < int((n_payments * amount) * (1 + 0.01)) |
| 2961 | |
| 2962 | # FIXME: Test cltv delta too ? |
| 2963 | |
| 2964 | |
| 2965 | def test_createonion_rpc(node_factory): |
nothing calls this directly
no test coverage detected