global: snapshot

This commit is contained in:
nym21
2025-02-27 12:32:54 +01:00
parent 677aca7a03
commit 877f9299e1
53 changed files with 259 additions and 203 deletions
+2
View File
@@ -1,5 +1,7 @@
mod error;
mod structs;
mod utils;
pub use error::*;
pub use structs::*;
pub use utils::*;
+1 -1
View File
@@ -177,7 +177,7 @@ impl From<Height> for u64 {
impl TryFrom<&Client> for Height {
type Error = bitcoincore_rpc::Error;
fn try_from(value: &Client) -> Result<Self, Self::Error> {
Ok((value.get_blockchain_info()?.blocks as usize - 1).into())
Ok((value.get_block_count()? as usize).into())
}
}
+5
View File
@@ -0,0 +1,5 @@
mod pause;
mod rlimit;
pub use pause::*;
pub use rlimit::*;
+7
View File
@@ -0,0 +1,7 @@
use log::info;
pub fn pause() {
info!("Press enter to continue...");
let mut buffer = String::new();
std::io::stdin().read_line(&mut buffer).expect("Failed to read line");
}
+10
View File
@@ -0,0 +1,10 @@
use std::io;
use rlimit::{Resource, getrlimit};
pub fn setrlimit() -> io::Result<()> {
let no_file_limit = getrlimit(Resource::NOFILE)?;
rlimit::setrlimit(Resource::NOFILE, no_file_limit.0.max(210_000), no_file_limit.1)?;
Ok(())
}