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

Function bolt11_with_metadata

tests/test_xpay.py:1495–1517  ·  view source on GitHub ↗

Re-encode inv (made by l2) with payment metadata attached.

(node, chainparams, inv, metadata)

Source from the content-addressed store, hash-verified

1493
1494
1495def bolt11_with_metadata(node, chainparams, inv, metadata):
1496 """Re-encode inv (made by l2) with payment metadata attached."""
1497 dec = node.rpc.decode(inv["bolt11"])
1498 return (
1499 subprocess.check_output(
1500 [
1501 "devtools/bolt11-cli",
1502 "encode",
1503 L2_PRIVKEY,
1504 f"currency={chainparams['bip173_prefix']}",
1505 f"p={inv['payment_hash']}",
1506 f"s={inv['payment_secret']}",
1507 f"d={dec['description']}",
1508 f"amount={dec['amount_msat']}msat",
1509 f"x={dec['expiry']}",
1510 f"c={dec['min_final_cltv_expiry']}",
1511 f"9={dec['features']}",
1512 "m=" + metadata.hex(),
1513 ]
1514 )
1515 .decode("utf-8")
1516 .strip()
1517 )
1518
1519
1520@unittest.skipIf(TEST_NETWORK != "regtest", "Invoice is network specific")

Callers 2

payFunction · 0.85

Calls 1

decodeMethod · 0.45

Tested by

no test coverage detected