From ea6923e2c075416882304c263b29be99ac24f824 Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Fri, 5 Jan 2024 09:48:10 +0100 Subject: [PATCH] poller: make the updating process into its own function. --- src/bitcoin/poller/looper.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/bitcoin/poller/looper.rs b/src/bitcoin/poller/looper.rs index cdff3920..a2381a61 100644 --- a/src/bitcoin/poller/looper.rs +++ b/src/bitcoin/poller/looper.rs @@ -325,6 +325,17 @@ fn sync_poll_interval() -> time::Duration { time::Duration::from_secs(0) } +/// Update our state from the Bitcoin backend. +pub fn poll( + bit: &sync::Arc>, + db: &sync::Arc>, + secp: &secp256k1::Secp256k1, + descs: &[descriptors::SinglePathLianaDesc], +) { + updates(bit, db, descs, secp); + rescan_check(bit, db, descs, secp); +} + /// Main event loop. Repeatedly polls the Bitcoin interface until told to stop through the /// `shutdown` atomic. pub fn looper( @@ -378,7 +389,6 @@ pub fn looper( } } - updates(&bit, &db, &descs, &secp); - rescan_check(&bit, &db, &descs, &secp); + poll(&bit, &db, &secp, &descs); } }