Test that we don't send the amount+fees to our direct peer (we should only send the required amount) when the sending node is the entry point in the blinded path.
(node_factory)
| 1371 | |
| 1372 | |
| 1373 | def test_blinded_path_fees(node_factory): |
| 1374 | """Test that we don't send the amount+fees to our direct peer (we should |
| 1375 | only send the required amount) when the sending node is the entry point in |
| 1376 | the blinded path.""" |
| 1377 | AMT_MSAT = 10000 |
| 1378 | FEES_MSAT = 5000 |
| 1379 | l1, l2 = node_factory.get_nodes( |
| 1380 | 2, opts={"may_reconnect": True, "fee-base": FEES_MSAT, "fee-per-satoshi": 0} |
| 1381 | ) |
| 1382 | node_factory.join_nodes([l1, l2], wait_for_announce=True) |
| 1383 | |
| 1384 | offer = l2.rpc.offer(amount="any", fronting_nodes=[l1.info["id"]])["bolt12"] |
| 1385 | b12 = l1.rpc.fetchinvoice(offer, AMT_MSAT)["invoice"] |
| 1386 | |
| 1387 | b12_decode = l1.rpc.decode(b12) |
| 1388 | assert b12_decode["invoice_amount_msat"] == AMT_MSAT |
| 1389 | assert len(b12_decode["invoice_paths"]) == 1 |
| 1390 | assert b12_decode["invoice_paths"][0]["first_node_id"] == l1.info["id"] |
| 1391 | assert b12_decode["invoice_paths"][0]["payinfo"]["fee_base_msat"] == FEES_MSAT |
| 1392 | assert b12_decode["invoice_paths"][0]["payinfo"]["fee_proportional_millionths"] == 0 |
| 1393 | |
| 1394 | ret = l1.rpc.xpay(invstring=b12) |
| 1395 | assert ret["failed_parts"] == 0 |
| 1396 | assert ret["successful_parts"] == 1 |
| 1397 | assert ret["amount_msat"] == AMT_MSAT |
| 1398 | assert ret["amount_sent_msat"] == AMT_MSAT |
| 1399 | |
| 1400 | htlcs = l1.rpc.listhtlcs()["htlcs"] |
| 1401 | assert len(htlcs) == 1 |
| 1402 | assert htlcs[0]["payment_hash"] == b12_decode["invoice_payment_hash"] |
| 1403 | assert htlcs[0]["amount_msat"] == AMT_MSAT |
| 1404 | |
| 1405 | |
| 1406 | def test_sendamount(node_factory): |
nothing calls this directly
no test coverage detected