poller: make the updating process into its own function.

This commit is contained in:
Antoine Poinsot 2024-01-05 09:48:10 +01:00
parent 4f78d3b3d0
commit ea6923e2c0
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304

View File

@ -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<sync::Mutex<dyn BitcoinInterface>>,
db: &sync::Arc<sync::Mutex<dyn DatabaseInterface>>,
secp: &secp256k1::Secp256k1<secp256k1::VerifyOnly>,
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);
}
}