@@ -25,20 +25,6 @@ def get_cb_forwards(index):
25
25
base .wait_for_all_tanks_status (target = "running" )
26
26
base .wait_for_all_edges ()
27
27
28
- if base .backend != "compose" :
29
- print ("\n Skipping network export test, only supported with compose backend" )
30
- else :
31
- print ("\n Testing warcli network export" )
32
- path = Path (base .warcli ("network export" )) / "sim.json"
33
- with open (path ) as file :
34
- data = json .load (file )
35
- print (json .dumps (data , indent = 4 ))
36
- assert len (data ["nodes" ]) == 3
37
- for node in data ["nodes" ]:
38
- assert os .path .exists (node ["macaroon" ])
39
- assert os .path .exists (node ["cert" ])
40
-
41
-
42
28
print ("\n Running LN Init scenario" )
43
29
base .warcli ("rpc 0 getblockcount" )
44
30
base .warcli ("scenarios run ln_init" )
@@ -86,17 +72,27 @@ def check_invoices():
86
72
print (base .warcli (f"lncli 2 payinvoice -f { inv } " ))
87
73
88
74
print ("Waiting for payment success" )
89
- def check_invoices ():
90
- invs = json .loads (base .warcli ("lncli 0 listinvoices" ))["invoices" ]
91
- if len ( invs ) > 0 and invs [ 0 ][ "state" ] == "SETTLED" :
92
- print ( " \n Settled!" )
93
- return True
94
- else :
95
- return False
96
- base .wait_for_predicate (check_invoices )
75
+ def check_invoices (index ):
76
+ invs = json .loads (base .warcli (f "lncli { index } listinvoices" ))["invoices" ]
77
+ settled = 0
78
+ for inv in invs :
79
+ if inv [ "state" ] == "SETTLED" :
80
+ settled += 1
81
+ return settled
82
+ base .wait_for_predicate (lambda : check_invoices ( 0 ) == 1 )
97
83
98
84
print ("\n Ensuring channel-level channel policy settings: target" )
99
85
payment = json .loads (base .warcli ("lncli 2 listpayments" ))["payments" ][0 ]
100
86
assert payment ["fee_msat" ] == "2213"
101
87
88
+ print ("\n Engaging simln" )
89
+ activity = [{
90
+ "source" : "ln-0" ,
91
+ "destination" : chan ["node1_pub" ],
92
+ "interval_secs" : 1 ,
93
+ "amount_msat" : 2000
94
+ }]
95
+ base .warcli (f"network export --activity={ json .dumps (activity ).replace (' ' , '' )} " )
96
+ base .wait_for_predicate (lambda : check_invoices (0 ) > 1 or check_invoices (1 ) > 1 or check_invoices (2 ) > 1 )
97
+
102
98
base .stop_server ()
0 commit comments