Skip to content

Commit

Permalink
test: ensure circuit breakers are monitoring HTLC forwards
Browse files Browse the repository at this point in the history
  • Loading branch information
pinheadmz committed Feb 28, 2024
1 parent 3d465af commit f45af42
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/ln_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@
import os
from pathlib import Path

from backends import ServiceType
from test_base import TestBase

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

base = TestBase()
base.start_server()

def get_cb_forwards(index):
cmd = "wget -q -O - localhost:9235/api/forwarding_history"
res = base.wait_for_rpc("exec_run", [index, ServiceType.CIRCUITBREAKER.value, cmd, base.network_name])
return json.loads(res)

print(base.warcli(f"network start {graph_file_path}"))
base.wait_for_all_tanks_status(target="running")

Expand All @@ -33,6 +40,8 @@
base.warcli("scenarios run ln_init")
base.wait_for_all_scenarios()

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

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

print("\nEnsuring circuit breaker tracked payment")
assert len(get_cb_forwards(1)["forwards"]) == 1

base.stop_server()

0 comments on commit f45af42

Please sign in to comment.