@@ -34,8 +34,8 @@ fn channel_full_cycle() {
34
34
) ;
35
35
node_a. sync_wallets ( ) . unwrap ( ) ;
36
36
node_b. sync_wallets ( ) . unwrap ( ) ;
37
- assert_eq ! ( node_a. onchain_balance ( ) . unwrap( ) . get_spendable ( ) , premine_amount_sat) ;
38
- assert_eq ! ( node_b. onchain_balance ( ) . unwrap( ) . get_spendable ( ) , premine_amount_sat) ;
37
+ assert_eq ! ( node_a. spendable_onchain_balance_sats ( ) . unwrap( ) , premine_amount_sat) ;
38
+ assert_eq ! ( node_b. spendable_onchain_balance_sats ( ) . unwrap( ) , premine_amount_sat) ;
39
39
40
40
// Check we haven't got any events yet
41
41
assert_eq ! ( node_a. next_event( ) , None ) ;
@@ -77,12 +77,11 @@ fn channel_full_cycle() {
77
77
node_b. sync_wallets ( ) . unwrap ( ) ;
78
78
79
79
let onchain_fee_buffer_sat = 1500 ;
80
- let node_a_balance = node_a. onchain_balance ( ) . unwrap ( ) ;
81
80
let node_a_upper_bound_sat = premine_amount_sat - funding_amount_sat;
82
81
let node_a_lower_bound_sat = premine_amount_sat - funding_amount_sat - onchain_fee_buffer_sat;
83
- assert ! ( node_a_balance . get_spendable ( ) < node_a_upper_bound_sat) ;
84
- assert ! ( node_a_balance . get_spendable ( ) > node_a_lower_bound_sat) ;
85
- assert_eq ! ( node_b. onchain_balance ( ) . unwrap( ) . get_spendable ( ) , premine_amount_sat) ;
82
+ assert ! ( node_a . spendable_onchain_balance_sats ( ) . unwrap ( ) < node_a_upper_bound_sat) ;
83
+ assert ! ( node_a . spendable_onchain_balance_sats ( ) . unwrap ( ) > node_a_lower_bound_sat) ;
84
+ assert_eq ! ( node_b. spendable_onchain_balance_sats ( ) . unwrap( ) , premine_amount_sat) ;
86
85
87
86
expect_event ! ( node_a, ChannelReady ) ;
88
87
@@ -215,10 +214,10 @@ fn channel_full_cycle() {
215
214
let node_a_upper_bound_sat =
216
215
( premine_amount_sat - funding_amount_sat) + ( funding_amount_sat - sum_of_all_payments_sat) ;
217
216
let node_a_lower_bound_sat = node_a_upper_bound_sat - onchain_fee_buffer_sat;
218
- assert ! ( node_a. onchain_balance ( ) . unwrap( ) . get_spendable ( ) > node_a_lower_bound_sat) ;
219
- assert ! ( node_a. onchain_balance ( ) . unwrap( ) . get_spendable ( ) < node_a_upper_bound_sat) ;
217
+ assert ! ( node_a. spendable_onchain_balance_sats ( ) . unwrap( ) > node_a_lower_bound_sat) ;
218
+ assert ! ( node_a. spendable_onchain_balance_sats ( ) . unwrap( ) < node_a_upper_bound_sat) ;
220
219
let expected_final_amount_node_b_sat = premine_amount_sat + sum_of_all_payments_sat;
221
- assert_eq ! ( node_b. onchain_balance ( ) . unwrap( ) . get_spendable ( ) , expected_final_amount_node_b_sat) ;
220
+ assert_eq ! ( node_b. spendable_onchain_balance_sats ( ) . unwrap( ) , expected_final_amount_node_b_sat) ;
222
221
223
222
// Check we handled all events
224
223
assert_eq ! ( node_a. next_event( ) , None ) ;
@@ -260,8 +259,8 @@ fn channel_open_fails_when_funds_insufficient() {
260
259
) ;
261
260
node_a. sync_wallets ( ) . unwrap ( ) ;
262
261
node_b. sync_wallets ( ) . unwrap ( ) ;
263
- assert_eq ! ( node_a. onchain_balance ( ) . unwrap( ) . get_spendable ( ) , premine_amount_sat) ;
264
- assert_eq ! ( node_b. onchain_balance ( ) . unwrap( ) . get_spendable ( ) , premine_amount_sat) ;
262
+ assert_eq ! ( node_a. spendable_onchain_balance_sats ( ) . unwrap( ) , premine_amount_sat) ;
263
+ assert_eq ! ( node_b. spendable_onchain_balance_sats ( ) . unwrap( ) , premine_amount_sat) ;
265
264
266
265
println ! ( "\n A -- connect_open_channel -> B" ) ;
267
266
assert_eq ! (
@@ -302,13 +301,13 @@ fn start_stop_reinit() {
302
301
let expected_amount = Amount :: from_sat ( 100000 ) ;
303
302
304
303
premine_and_distribute_funds ( & bitcoind, & electrsd, vec ! [ funding_address] , expected_amount) ;
305
- assert_eq ! ( node. onchain_balance ( ) . unwrap( ) . get_total ( ) , 0 ) ;
304
+ assert_eq ! ( node. total_onchain_balance_sats ( ) . unwrap( ) , 0 ) ;
306
305
307
306
node. start ( ) . unwrap ( ) ;
308
307
assert_eq ! ( node. start( ) , Err ( Error :: AlreadyRunning ) ) ;
309
308
310
309
node. sync_wallets ( ) . unwrap ( ) ;
311
- assert_eq ! ( node. onchain_balance ( ) . unwrap( ) . get_spendable ( ) , expected_amount. to_sat( ) ) ;
310
+ assert_eq ! ( node. spendable_onchain_balance_sats ( ) . unwrap( ) , expected_amount. to_sat( ) ) ;
312
311
313
312
node. stop ( ) . unwrap ( ) ;
314
313
assert_eq ! ( node. stop( ) , Err ( Error :: NotRunning ) ) ;
@@ -328,13 +327,13 @@ fn start_stop_reinit() {
328
327
reinitialized_node. start ( ) . unwrap ( ) ;
329
328
330
329
assert_eq ! (
331
- reinitialized_node. onchain_balance ( ) . unwrap( ) . get_spendable ( ) ,
330
+ reinitialized_node. spendable_onchain_balance_sats ( ) . unwrap( ) ,
332
331
expected_amount. to_sat( )
333
332
) ;
334
333
335
334
reinitialized_node. sync_wallets ( ) . unwrap ( ) ;
336
335
assert_eq ! (
337
- reinitialized_node. onchain_balance ( ) . unwrap( ) . get_spendable ( ) ,
336
+ reinitialized_node. spendable_onchain_balance_sats ( ) . unwrap( ) ,
338
337
expected_amount. to_sat( )
339
338
) ;
340
339
@@ -369,7 +368,7 @@ fn onchain_spend_receive() {
369
368
370
369
node_a. sync_wallets ( ) . unwrap ( ) ;
371
370
node_b. sync_wallets ( ) . unwrap ( ) ;
372
- assert_eq ! ( node_b. onchain_balance ( ) . unwrap( ) . get_spendable ( ) , 100000 ) ;
371
+ assert_eq ! ( node_b. spendable_onchain_balance_sats ( ) . unwrap( ) , 100000 ) ;
373
372
374
373
assert_eq ! ( Err ( Error :: InsufficientFunds ) , node_a. send_to_onchain_address( & addr_b, 1000 ) ) ;
375
374
@@ -380,9 +379,9 @@ fn onchain_spend_receive() {
380
379
node_a. sync_wallets ( ) . unwrap ( ) ;
381
380
node_b. sync_wallets ( ) . unwrap ( ) ;
382
381
383
- assert_eq ! ( node_a. onchain_balance ( ) . unwrap( ) . get_spendable ( ) , 1000 ) ;
384
- assert ! ( node_b. onchain_balance ( ) . unwrap( ) . get_spendable ( ) > 98000 ) ;
385
- assert ! ( node_b. onchain_balance ( ) . unwrap( ) . get_spendable ( ) < 100000 ) ;
382
+ assert_eq ! ( node_a. spendable_onchain_balance_sats ( ) . unwrap( ) , 1000 ) ;
383
+ assert ! ( node_b. spendable_onchain_balance_sats ( ) . unwrap( ) > 98000 ) ;
384
+ assert ! ( node_b. spendable_onchain_balance_sats ( ) . unwrap( ) < 100000 ) ;
386
385
387
386
let addr_b = node_b. new_funding_address ( ) . unwrap ( ) ;
388
387
let txid = node_a. send_all_to_onchain_address ( & addr_b) . unwrap ( ) ;
@@ -392,9 +391,9 @@ fn onchain_spend_receive() {
392
391
node_a. sync_wallets ( ) . unwrap ( ) ;
393
392
node_b. sync_wallets ( ) . unwrap ( ) ;
394
393
395
- assert_eq ! ( node_a. onchain_balance ( ) . unwrap( ) . get_total ( ) , 0 ) ;
396
- assert ! ( node_b. onchain_balance ( ) . unwrap( ) . get_spendable ( ) > 99000 ) ;
397
- assert ! ( node_b. onchain_balance ( ) . unwrap( ) . get_spendable ( ) < 100000 ) ;
394
+ assert_eq ! ( node_a. total_onchain_balance_sats ( ) . unwrap( ) , 0 ) ;
395
+ assert ! ( node_b. spendable_onchain_balance_sats ( ) . unwrap( ) > 99000 ) ;
396
+ assert ! ( node_b. spendable_onchain_balance_sats ( ) . unwrap( ) < 100000 ) ;
398
397
}
399
398
400
399
#[ test]
0 commit comments