@@ -25,20 +25,6 @@ def get_cb_forwards(index):
2525base .wait_for_all_tanks_status (target = "running" )
2626base .wait_for_all_edges ()
2727
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-
4228print ("\n Running LN Init scenario" )
4329base .warcli ("rpc 0 getblockcount" )
4430base .warcli ("scenarios run ln_init" )
@@ -86,17 +72,27 @@ def check_invoices():
8672print (base .warcli (f"lncli 2 payinvoice -f { inv } " ))
8773
8874print ("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 )
9783
9884print ("\n Ensuring channel-level channel policy settings: target" )
9985payment = json .loads (base .warcli ("lncli 2 listpayments" ))["payments" ][0 ]
10086assert payment ["fee_msat" ] == "2213"
10187
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+
10298base .stop_server ()
0 commit comments