Skip to content

Commit 588da81

Browse files
pinheadmzwillcl-ark
authored andcommitted
test: ensure circuit breakers are monitoring HTLC forwards
1 parent fce58c1 commit 588da81

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/ln_test.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@
44
import os
55
from pathlib import Path
66

7+
from backends import ServiceType
78
from test_base import TestBase
89

910
graph_file_path = Path(os.path.dirname(__file__)) / "data" / "ln.graphml"
1011

1112
base = TestBase()
1213
base.start_server()
14+
15+
def get_cb_forwards(index):
16+
cmd = "wget -q -O - localhost:9235/api/forwarding_history"
17+
res = base.wait_for_rpc("exec_run", [index, ServiceType.CIRCUITBREAKER.value, cmd, base.network_name])
18+
return json.loads(res)
19+
1320
print(base.warcli(f"network start {graph_file_path}"))
1421
base.wait_for_all_tanks_status(target="running")
1522

@@ -33,6 +40,8 @@
3340
base.warcli("scenarios run ln_init")
3441
base.wait_for_all_scenarios()
3542

43+
print("\nEnsuring no circuit breaker forwards yet")
44+
assert len(get_cb_forwards(1)["forwards"]) == 0
3645

3746
print("\nTest LN payment from 0 -> 2")
3847
inv = json.loads(base.warcli("lncli 2 addinvoice --amt=1234"))["payment_request"]
@@ -51,4 +60,7 @@ def check_invoices():
5160
return False
5261
base.wait_for_predicate(check_invoices)
5362

63+
print("\nEnsuring circuit breaker tracked payment")
64+
assert len(get_cb_forwards(1)["forwards"]) == 1
65+
5466
base.stop_server()

0 commit comments

Comments
 (0)