use clap::{Parser, Subcommand};
use utxodump::{WithError, utxodump, utxohex160};
mod utxodump;
#[derive(Subcommand)]
enum Commands {
Utxodump {
blocks_dir: String,
outfile: String,
},
Utxo160 {
utxofile: String,
},
}
#[derive(Parser)]
#[command(name = "bcloop")]
struct Cli {
#[command(subcommand)]
command: Commands,
}
fn main() -> WithError {
let cpu_count = std::thread::available_parallelism()?.get();
rayon::ThreadPoolBuilder::new().num_threads(cpu_count * 2).build_global()?;
let cli = Cli::parse();
match cli.command {
Commands::Utxodump { blocks_dir, outfile } => utxodump(&blocks_dir, &outfile)?,
Commands::Utxo160 { utxofile } => utxohex160(&utxofile)?,
}
Ok(())
}