During installation, the user may choose for Liana to configure and start bitcoind for them. This internal bitcoind uses as its data directory the `bitcoind_datadir` folder within the Liana data directory. If the internal bitcoind option has been selected for a network, it will be automatically started when the user returns to Liana and stopped when Liana is closed.
22 lines
552 B
Rust
22 lines
552 B
Rust
use std::path::Path;
|
|
|
|
#[cfg(test)]
|
|
pub mod sandbox;
|
|
|
|
#[cfg(test)]
|
|
pub mod mock;
|
|
|
|
/// Polls for a file's existence at given interval up to a maximum number of polls.
|
|
/// Returns `true` once file exists and otherwise `false`.
|
|
pub fn poll_for_file(path: &Path, interval_millis: u64, max_polls: u16) -> bool {
|
|
for i in 0..max_polls {
|
|
if path.exists() {
|
|
return true;
|
|
}
|
|
if i < max_polls.saturating_sub(1) {
|
|
std::thread::sleep(std::time::Duration::from_millis(interval_millis));
|
|
}
|
|
}
|
|
false
|
|
}
|