@@ -137,8 +137,8 @@ fn channel_full_cycle() {
137
137
premine_and_distribute_funds ( vec ! [ addr_a, addr_b] , Amount :: from_sat ( 100000 ) ) ;
138
138
node_a. sync_wallets ( ) . unwrap ( ) ;
139
139
node_b. sync_wallets ( ) . unwrap ( ) ;
140
- assert_eq ! ( node_a. on_chain_balance( ) . unwrap( ) . confirmed , 100000 ) ;
141
- assert_eq ! ( node_b. on_chain_balance( ) . unwrap( ) . confirmed , 100000 ) ;
140
+ assert_eq ! ( node_a. on_chain_balance( ) . unwrap( ) . get_spendable ( ) , 100000 ) ;
141
+ assert_eq ! ( node_b. on_chain_balance( ) . unwrap( ) . get_spendable ( ) , 100000 ) ;
142
142
143
143
println ! ( "\n A -- connect_open_channel -> B" ) ;
144
144
let node_b_addr =
@@ -154,9 +154,9 @@ fn channel_full_cycle() {
154
154
node_b. sync_wallets ( ) . unwrap ( ) ;
155
155
156
156
let node_a_balance = node_a. on_chain_balance ( ) . unwrap ( ) ;
157
- assert ! ( node_a_balance. confirmed < 50000 ) ;
158
- assert ! ( node_a_balance. confirmed > 40000 ) ;
159
- assert_eq ! ( node_b. on_chain_balance( ) . unwrap( ) . confirmed , 100000 ) ;
157
+ assert ! ( node_a_balance. get_spendable ( ) < 50000 ) ;
158
+ assert ! ( node_a_balance. get_spendable ( ) > 40000 ) ;
159
+ assert_eq ! ( node_b. on_chain_balance( ) . unwrap( ) . get_spendable ( ) , 100000 ) ;
160
160
161
161
expect_event ! ( node_a, ChannelReady ) ;
162
162
@@ -181,17 +181,17 @@ fn channel_full_cycle() {
181
181
expect_event ! ( node_b, PaymentReceived ) ;
182
182
183
183
node_b. close_channel ( & channel_id, & node_a. node_id ( ) . unwrap ( ) ) . unwrap ( ) ;
184
- generate_blocks_and_wait ( 1 ) ;
185
-
186
184
expect_event ! ( node_a, ChannelClosed ) ;
187
185
expect_event ! ( node_b, ChannelClosed ) ;
188
186
189
- // TODO: Not entirely sure why we need *another* confirmation before the funds show up as
190
- // confirmed. Is this expected or a BDK bug?
187
+ // Wait a sec so the shutdown tx can 'propagate' via EsploraD to BitcoinD.
188
+ std:: thread:: sleep ( Duration :: from_secs ( 1 ) ) ;
189
+
191
190
generate_blocks_and_wait ( 1 ) ;
192
191
node_a. sync_wallets ( ) . unwrap ( ) ;
193
- assert ! ( node_a. on_chain_balance( ) . unwrap( ) . confirmed > 90000 ) ;
194
- assert_eq ! ( node_b. on_chain_balance( ) . unwrap( ) . confirmed, 100000 ) ;
192
+
193
+ assert ! ( node_a. on_chain_balance( ) . unwrap( ) . get_spendable( ) > 90000 ) ;
194
+ assert_eq ! ( node_b. on_chain_balance( ) . unwrap( ) . get_spendable( ) , 100000 ) ;
195
195
196
196
node_a. stop ( ) . unwrap ( ) ;
197
197
println ! ( "\n A stopped" ) ;
0 commit comments