MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_blinded_path_fees

Function test_blinded_path_fees

tests/test_xpay.py:1373–1403  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1371
1372
1373def 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
1406def test_sendamount(node_factory):

Callers

nothing calls this directly

Calls 6

get_nodesMethod · 0.80
join_nodesMethod · 0.80
fetchinvoiceMethod · 0.80
offerMethod · 0.45
decodeMethod · 0.45
xpayMethod · 0.45

Tested by

no test coverage detected