@@ -45,17 +45,17 @@ def get_cb_forwards(index):
45
45
base .wait_for_all_scenarios ()
46
46
47
47
print ("\n Ensuring node-level channel policy settings" )
48
- chans = json .loads (base .warcli ("lncli 1 describegraph " ))["edges " ]
49
- for chan in chans :
50
- # node_1 or node_2 is tank 1 with its non-default --bitcoin.timelockdelta=20
51
- if chan ["node1_policy" ]["time_lock_delta" ] != 20 :
52
- assert chan ["node2_policy" ]["time_lock_delta" ] == 20
48
+ chan_id = json .loads (base .warcli ("lncli 2 listchannels " ))["channels" ][ 0 ][ "chan_id " ]
49
+ chan = json . loads ( base . warcli ( f"lncli 2 getchaninfo { chan_id } " ))
50
+ # node_1 or node_2 is tank 2 with its non-default --bitcoin.timelockdelta=33
51
+ if chan ["node1_policy" ]["time_lock_delta" ] != 33 :
52
+ assert chan ["node2_policy" ]["time_lock_delta" ] == 33
53
53
54
54
print ("\n Ensuring no circuit breaker forwards yet" )
55
55
assert len (get_cb_forwards (1 )["forwards" ]) == 0
56
56
57
57
print ("\n Test LN payment from 0 -> 2" )
58
- inv = json .loads (base .warcli ("lncli 2 addinvoice --amt=1234 " ))["payment_request" ]
58
+ inv = json .loads (base .warcli ("lncli 2 addinvoice --amt=2000 " ))["payment_request" ]
59
59
60
60
print (f"\n Got invoice from node 2: { inv } " )
61
61
print ("\n Paying invoice from node 0..." )
@@ -71,11 +71,32 @@ def check_invoices():
71
71
return False
72
72
base .wait_for_predicate (check_invoices )
73
73
74
- print ("\n Ensuring channel-level channel policy settings" )
74
+ print ("\n Ensuring channel-level channel policy settings: source " )
75
75
payment = json .loads (base .warcli ("lncli 0 listpayments" ))["payments" ][0 ]
76
- assert payment ["fee_msat" ] == "5503 "
76
+ assert payment ["fee_msat" ] == "5506 "
77
77
78
78
print ("\n Ensuring circuit breaker tracked payment" )
79
79
assert len (get_cb_forwards (1 )["forwards" ]) == 1
80
80
81
+ print ("\n Test LN payment from 2 -> 0" )
82
+ inv = json .loads (base .warcli ("lncli 0 addinvoice --amt=1000" ))["payment_request" ]
83
+
84
+ print (f"\n Got invoice from node 0: { inv } " )
85
+ print ("\n Paying invoice from node 2..." )
86
+ print (base .warcli (f"lncli 2 payinvoice -f { inv } " ))
87
+
88
+ 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 )
97
+
98
+ print ("\n Ensuring channel-level channel policy settings: target" )
99
+ payment = json .loads (base .warcli ("lncli 2 listpayments" ))["payments" ][0 ]
100
+ assert payment ["fee_msat" ] == "2213"
101
+
81
102
base .stop_server ()
0 commit comments