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

Function test_cltv_value

tests/test_renepay.py:879–903  ·  view source on GitHub ↗
(node_factory, bitcoind)

Source from the content-addressed store, hash-verified

877
878
879def test_cltv_value(node_factory, bitcoind):
880 cltv_delta = 5
881 l1, l2, l3 = node_factory.line_graph(
882 3,
883 wait_for_announce=True,
884 opts={
885 "allow-deprecated-apis": True,
886 "cltv-delta": cltv_delta,
887 "fee-base": 0,
888 "fee-per-satoshi": 0,
889 },
890 )
891 blockheight = l1.rpc.waitblockheight(0)["blockheight"]
892 # BOLT-11 direct peer
893 b11 = l3.rpc.invoice(
894 "100sat", "test_renepay_expiry_too_far", "test_renepay_expiry_too_far"
895 )["bolt11"]
896 decoded_b11 = l1.rpc.decode(b11)
897 final_cltv = decoded_b11["min_final_cltv_expiry"]
898 ret = l1.rpc.call("renepay", {"invstring": b11})
899 assert ret["status"] == "complete"
900 pattern = r"Adding HTLC 0 amount=100000msat cltv=(\d+)"
901 line = l1.daemon.wait_for_log(pattern)
902 cltv = int(re.search(pattern, line).group(1))
903 assert cltv == (blockheight + 1) + cltv_delta + final_cltv

Callers

nothing calls this directly

Calls 6

line_graphMethod · 0.80
waitblockheightMethod · 0.80
wait_for_logMethod · 0.80
invoiceMethod · 0.45
decodeMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected