Topology: 1----2----4 | | 3----5----6 This a payment that fails if pending HTLCs are not taken into account when we build the network capacities.
(node_factory)
| 357 | |
| 358 | |
| 359 | def test_hardmpp(node_factory): |
| 360 | """ |
| 361 | Topology: |
| 362 | 1----2----4 |
| 363 | | | |
| 364 | 3----5----6 |
| 365 | This a payment that fails if pending HTLCs are not taken into account when |
| 366 | we build the network capacities. |
| 367 | """ |
| 368 | opts = [ |
| 369 | {"disable-mpp": None, "fee-base": 0, "fee-per-satoshi": 0, 'allow-deprecated-apis': True}, |
| 370 | ] |
| 371 | l1, l2, l3, l4, l5, l6 = node_factory.get_nodes(6, opts=opts * 6) |
| 372 | start_channels( |
| 373 | [ |
| 374 | (l1, l2, 10000000), |
| 375 | (l2, l4, 3000000), |
| 376 | (l4, l6, 10000000), |
| 377 | (l1, l3, 10000000), |
| 378 | (l3, l5, 1000000), |
| 379 | (l5, l6, 10000000), |
| 380 | ] |
| 381 | ) |
| 382 | |
| 383 | inv = l4.rpc.invoice("any", "any", "description") |
| 384 | l2.rpc.call("pay", {"bolt11": inv["bolt11"], "amount_msat": 2000000000}) |
| 385 | l2.wait_for_htlcs() |
| 386 | assert l4.rpc.listinvoices()["invoices"][0]["amount_received_msat"] == 2000000000 |
| 387 | |
| 388 | inv2 = l6.rpc.invoice("1800000sat", "inv2", "description") |
| 389 | |
| 390 | out = subprocess.check_output( |
| 391 | [ |
| 392 | "cli/lightning-cli", |
| 393 | "--network={}".format(TEST_NETWORK), |
| 394 | "--lightning-dir={}".format(l1.daemon.lightning_dir), |
| 395 | "-k", |
| 396 | "renepay", |
| 397 | "invstring={}".format(inv2["bolt11"]), |
| 398 | ] |
| 399 | ).decode("utf-8") |
| 400 | lines = out.split("\n") |
| 401 | # First comes commentry |
| 402 | assert any([l.startswith("#") for l in lines]) |
| 403 | |
| 404 | # Now comes JSON |
| 405 | json.loads("".join([l for l in lines if not l.startswith("#")])) |
| 406 | l1.wait_for_htlcs() |
| 407 | invoice = only_one(l6.rpc.listinvoices("inv2")["invoices"]) |
| 408 | assert invoice["amount_received_msat"] >= Millisatoshi("1800000sat") |
| 409 | |
| 410 | |
| 411 | @pytest.mark.flaky(reruns=2) |
nothing calls this directly
no test coverage detected