Skip to content

Commit 33f8165

Browse files
committed
Move inner code to poll_and_update_listeners_inner
Previously, we might have overlooked some cases that would exit the method and bubble up an error via `?` instead of propagating to all subscribers. Here, we split out the code to an inner method to ensure we always propagate.
1 parent 3bc4789 commit 33f8165

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/chain/bitcoind.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,18 @@ impl BitcoindChainSource {
306306
})?;
307307
}
308308

309+
let res = self
310+
.poll_and_update_listeners_inner(channel_manager, chain_monitor, output_sweeper)
311+
.await;
312+
313+
self.wallet_polling_status.lock().unwrap().propagate_result_to_subscribers(res);
314+
res
315+
}
316+
317+
async fn poll_and_update_listeners_inner(
318+
&self, channel_manager: Arc<ChannelManager>, chain_monitor: Arc<ChainMonitor>,
319+
output_sweeper: Arc<Sweeper>,
320+
) -> Result<(), Error> {
309321
let latest_chain_tip_opt = self.latest_chain_tip.read().unwrap().clone();
310322
let chain_tip = if let Some(tip) = latest_chain_tip_opt {
311323
tip
@@ -403,9 +415,7 @@ impl BitcoindChainSource {
403415
},
404416
}
405417

406-
let res = Ok(());
407-
self.wallet_polling_status.lock().unwrap().propagate_result_to_subscribers(res);
408-
res
418+
Ok(())
409419
}
410420

411421
pub(super) async fn update_fee_rate_estimates(&self) -> Result<(), Error> {

0 commit comments

Comments
 (0)