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

Function test_unreserve_all

tests/test_askrene.py:2052–2076  ·  view source on GitHub ↗

Test removing all reservations.

(node_factory)

Source from the content-addressed store, hash-verified

2050
2051
2052def test_unreserve_all(node_factory):
2053 """Test removing all reservations."""
2054 l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True)
2055
2056 # initially no reserves
2057 assert l1.rpc.askrene_listreservations() == {"reservations": []}
2058
2059 # then we add a couple of reservations
2060 scid12 = first_scid(l1, l2)
2061 scid23 = first_scid(l2, l3)
2062 scid12dir = f"{scid12}/{direction(l1.info['id'], l2.info['id'])}"
2063 scid23dir = f"{scid23}/{direction(l2.info['id'], l3.info['id'])}"
2064 l1.rpc.askrene_reserve(
2065 path=[
2066 {"short_channel_id_dir": scid12dir, "amount_msat": 1000_000},
2067 {"short_channel_id_dir": scid23dir, "amount_msat": 1000_001},
2068 ]
2069 )
2070
2071 listres = l1.rpc.askrene_listreservations()["reservations"]
2072 assert len(listres) == 2
2073
2074 # remove all reservations
2075 l1.rpc.askrene_unreserve(path=[], dev_remove_all=True)
2076 assert l1.rpc.askrene_listreservations() == {"reservations": []}
2077
2078
2079def test_reservations_leak_under_load(node_factory, executor):

Callers

nothing calls this directly

Calls 3

first_scidFunction · 0.90
line_graphMethod · 0.80
directionFunction · 0.70

Tested by

no test coverage detected