parity-zcash/pbtc/main.rs

72 lines
1.6 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;
2017-01-10 00:58:55 -08:00
extern crate libc;
2016-09-30 05:44:50 -07:00
extern crate storage;
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;
2016-12-01 01:40:56 -08:00
extern crate logs;
2016-09-30 05:44:50 -07:00
extern crate script;
2016-10-03 07:29:07 -07:00
extern crate message;
extern crate network;
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-12-07 05:14:52 -08:00
extern crate rpc as ethcore_rpc;
2017-01-10 00:58:55 -08:00
extern crate primitives;
extern crate verification;
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-30 05:37:17 -08:00
mod seednodes;
2016-11-03 09:19:35 -07:00
mod util;
2016-12-07 05:14:52 -08:00
mod rpc;
mod rpc_apis;
2016-11-03 09:19:35 -07:00
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-12-01 01:40:56 -08:00
pub const LOG_INFO: &'static str = "sync=info";
2016-09-30 05:44:50 -07:00
fn main() {
// Always print backtrace on panic.
::std::env::set_var("RUST_BACKTRACE", "1");
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
2017-08-29 06:36:26 -07:00
if !cfg.quiet {
2016-12-01 01:40:56 -08:00
if cfg!(windows) {
logs::init(LOG_INFO, logs::DateLogFormatter);
} else {
logs::init(LOG_INFO, logs::DateAndColorLogFormatter);
}
} else {
env_logger::init();
2016-12-01 01:40:56 -08: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),
2017-08-23 02:24:09 -07:00
("rollback", Some(rollback_matches)) => commands::rollback(cfg, rollback_matches),
2016-11-03 09:19:35 -07:00
_ => commands::start(cfg),
2016-10-30 19:12:44 -07:00
}
2016-11-03 03:53:39 -07:00
}