mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-12 19:48:15 -07:00
global: snapshot
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
mod error;
|
||||
mod structs;
|
||||
mod utils;
|
||||
|
||||
pub use error::*;
|
||||
pub use structs::*;
|
||||
pub use utils::*;
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
mod pause;
|
||||
mod rlimit;
|
||||
|
||||
pub use pause::*;
|
||||
pub use rlimit::*;
|
||||
@@ -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");
|
||||
}
|
||||
@@ -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(())
|
||||
}
|
||||
Reference in New Issue
Block a user