Test that we respect maxfeepercent for shadow routing.
(node_factory)
| 470 | |
| 471 | |
| 472 | def test_pay_maxfee_shadow(node_factory): |
| 473 | """Test that we respect maxfeepercent for shadow routing.""" |
| 474 | l1, l2, l3 = node_factory.line_graph(3, fundchannel=True, |
| 475 | wait_for_announce=True) |
| 476 | # We use this to search for shadow routes |
| 477 | wait_for( |
| 478 | lambda: len(l1.rpc.listchannels(source=l2.info["id"])["channels"]) > 1 |
| 479 | ) |
| 480 | |
| 481 | # shadow routes are random, so run multiple times. |
| 482 | for i in range(5): |
| 483 | # A tiny amount, we must not add the base_fee between l2 and l3 |
| 484 | amount = 2 |
| 485 | bolt11 = l2.rpc.invoice(amount, "tiny.{}".format(i), "tiny")["bolt11"] |
| 486 | pay_status = l1.rpc.pay(bolt11) |
| 487 | assert pay_status["amount_msat"] == Millisatoshi(amount) |
| 488 | |
| 489 | # shadow routes are random, so run multiple times. |
| 490 | for i in range(5): |
| 491 | # A bigger amount, shadow routing could have been used but we set a low |
| 492 | # maxfeepercent. |
| 493 | amount = 20000 |
| 494 | bolt11 = l2.rpc.invoice(amount, "big.{}".format(i), "bigger")["bolt11"] |
| 495 | pay_status = l1.rpc.pay(bolt11, maxfeepercent=0.001) |
| 496 | assert pay_status["amount_msat"] == Millisatoshi(amount) |
| 497 | |
| 498 | |
| 499 | def test_sendpay(node_factory): |
nothing calls this directly
no test coverage detected