Skip to content

Commit 36e59e4

Browse files
committed
f Address test TODO
1 parent 4278e21 commit 36e59e4

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/tests/functional_tests.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ fn channel_full_cycle() {
137137
premine_and_distribute_funds(vec![addr_a, addr_b], Amount::from_sat(100000));
138138
node_a.sync_wallets().unwrap();
139139
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);
142142

143143
println!("\nA -- connect_open_channel -> B");
144144
let node_b_addr =
@@ -154,9 +154,9 @@ fn channel_full_cycle() {
154154
node_b.sync_wallets().unwrap();
155155

156156
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);
160160

161161
expect_event!(node_a, ChannelReady);
162162

@@ -181,17 +181,17 @@ fn channel_full_cycle() {
181181
expect_event!(node_b, PaymentReceived);
182182

183183
node_b.close_channel(&channel_id, &node_a.node_id().unwrap()).unwrap();
184-
generate_blocks_and_wait(1);
185-
186184
expect_event!(node_a, ChannelClosed);
187185
expect_event!(node_b, ChannelClosed);
188186

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+
191190
generate_blocks_and_wait(1);
192191
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);
195195

196196
node_a.stop().unwrap();
197197
println!("\nA stopped");

0 commit comments

Comments
 (0)