@@ -34,8 +34,8 @@ fn channel_full_cycle() {
3434 ) ;
3535 node_a. sync_wallets ( ) . unwrap ( ) ;
3636 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) ;
3939
4040 // Check we haven't got any events yet
4141 assert_eq ! ( node_a. next_event( ) , None ) ;
@@ -77,12 +77,11 @@ fn channel_full_cycle() {
7777 node_b. sync_wallets ( ) . unwrap ( ) ;
7878
7979 let onchain_fee_buffer_sat = 1500 ;
80- let node_a_balance = node_a. onchain_balance ( ) . unwrap ( ) ;
8180 let node_a_upper_bound_sat = premine_amount_sat - funding_amount_sat;
8281 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) ;
8685
8786 expect_event ! ( node_a, ChannelReady ) ;
8887
@@ -215,10 +214,10 @@ fn channel_full_cycle() {
215214 let node_a_upper_bound_sat =
216215 ( premine_amount_sat - funding_amount_sat) + ( funding_amount_sat - sum_of_all_payments_sat) ;
217216 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) ;
220219 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) ;
222221
223222 // Check we handled all events
224223 assert_eq ! ( node_a. next_event( ) , None ) ;
@@ -260,8 +259,8 @@ fn channel_open_fails_when_funds_insufficient() {
260259 ) ;
261260 node_a. sync_wallets ( ) . unwrap ( ) ;
262261 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) ;
265264
266265 println ! ( "\n A -- connect_open_channel -> B" ) ;
267266 assert_eq ! (
@@ -302,13 +301,13 @@ fn start_stop_reinit() {
302301 let expected_amount = Amount :: from_sat ( 100000 ) ;
303302
304303 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 ) ;
306305
307306 node. start ( ) . unwrap ( ) ;
308307 assert_eq ! ( node. start( ) , Err ( Error :: AlreadyRunning ) ) ;
309308
310309 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( ) ) ;
312311
313312 node. stop ( ) . unwrap ( ) ;
314313 assert_eq ! ( node. stop( ) , Err ( Error :: NotRunning ) ) ;
@@ -328,13 +327,13 @@ fn start_stop_reinit() {
328327 reinitialized_node. start ( ) . unwrap ( ) ;
329328
330329 assert_eq ! (
331- reinitialized_node. onchain_balance ( ) . unwrap( ) . get_spendable ( ) ,
330+ reinitialized_node. spendable_onchain_balance_sats ( ) . unwrap( ) ,
332331 expected_amount. to_sat( )
333332 ) ;
334333
335334 reinitialized_node. sync_wallets ( ) . unwrap ( ) ;
336335 assert_eq ! (
337- reinitialized_node. onchain_balance ( ) . unwrap( ) . get_spendable ( ) ,
336+ reinitialized_node. spendable_onchain_balance_sats ( ) . unwrap( ) ,
338337 expected_amount. to_sat( )
339338 ) ;
340339
@@ -369,7 +368,7 @@ fn onchain_spend_receive() {
369368
370369 node_a. sync_wallets ( ) . unwrap ( ) ;
371370 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 ) ;
373372
374373 assert_eq ! ( Err ( Error :: InsufficientFunds ) , node_a. send_to_onchain_address( & addr_b, 1000 ) ) ;
375374
@@ -380,9 +379,9 @@ fn onchain_spend_receive() {
380379 node_a. sync_wallets ( ) . unwrap ( ) ;
381380 node_b. sync_wallets ( ) . unwrap ( ) ;
382381
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 ) ;
386385
387386 let addr_b = node_b. new_funding_address ( ) . unwrap ( ) ;
388387 let txid = node_a. send_all_to_onchain_address ( & addr_b) . unwrap ( ) ;
@@ -392,9 +391,9 @@ fn onchain_spend_receive() {
392391 node_a. sync_wallets ( ) . unwrap ( ) ;
393392 node_b. sync_wallets ( ) . unwrap ( ) ;
394393
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 ) ;
398397}
399398
400399#[ test]
0 commit comments