parity-zcash/pbtc/main.rs

48 lines
1.0 KiB
Rust
Raw Normal View History

2016-09-30 05:44:50 -07:00
//! Parity bitcoin client.
#[macro_use]
extern crate clap;
2016-11-03 09:19:35 -07:00
#[macro_use]
extern crate log;
extern crate env_logger;
2016-11-03 09:19:35 -07:00
extern crate app_dirs;
2016-09-30 05:44:50 -07:00
2016-10-30 19:12:44 -07:00
extern crate db;
extern crate chain;
2016-09-30 05:44:50 -07:00
extern crate keys;
extern crate script;
2016-10-03 07:29:07 -07:00
extern crate message;
2016-09-30 05:59:16 -07:00
extern crate p2p;
extern crate sync;
2016-10-30 19:12:44 -07:00
extern crate import;
2016-09-30 05:59:16 -07:00
2016-11-03 09:19:35 -07:00
mod commands;
2016-10-02 18:01:46 -07:00
mod config;
2016-11-03 09:19:35 -07:00
mod util;
use app_dirs::AppInfo;
2016-09-30 05:44:50 -07:00
2016-11-03 09:19:35 -07:00
pub const APP_INFO: AppInfo = AppInfo { name: "pbtc", author: "Parity" };
pub const PROTOCOL_VERSION: u32 = 70_014;
pub const PROTOCOL_MINIMUM: u32 = 70_001;
pub const USER_AGENT: &'static str = "pbtc";
pub const REGTEST_USER_AGENT: &'static str = "/Satoshi:0.12.1/";
2016-09-30 05:44:50 -07:00
fn main() {
env_logger::init().unwrap();
if let Err(err) = run() {
println!("{}", err);
2016-10-02 18:01:46 -07:00
}
}
fn run() -> Result<(), String> {
2016-09-30 05:44:50 -07:00
let yaml = load_yaml!("cli.yml");
let matches = clap::App::from_yaml(yaml).get_matches();
2016-11-03 09:19:35 -07:00
let cfg = try!(config::parse(&matches));
2016-09-30 07:25:28 -07:00
2016-11-03 03:53:39 -07:00
match matches.subcommand() {
2016-11-03 09:19:35 -07:00
("import", Some(import_matches)) => commands::import(cfg, import_matches),
_ => commands::start(cfg),
2016-10-30 19:12:44 -07:00
}
2016-11-03 03:53:39 -07:00
}