|
|
@@ -37,7 +37,9 @@ use darkfi::{
|
|
|
decode_base10, expand_path,
|
|
|
path::get_config_path,
|
|
|
serial::serialize,
|
|
|
- sleep, NetworkName,
|
|
|
+ sleep,
|
|
|
+ time::check_clock,
|
|
|
+ NetworkName,
|
|
|
},
|
|
|
wallet::walletdb::init_wallet,
|
|
|
Error, Result,
|
|
|
@@ -113,6 +115,10 @@ struct Args {
|
|
|
/// Airdrop amount limit
|
|
|
airdrop_limit: String, // We convert this to biguint with decode_base10
|
|
|
|
|
|
+ #[structopt(long)]
|
|
|
+ /// Verify system clock is correct
|
|
|
+ clock_sync: bool,
|
|
|
+
|
|
|
#[structopt(short, parse(from_occurrences))]
|
|
|
/// Increase verbosity (-vvv supported)
|
|
|
verbose: u8,
|
|
|
@@ -295,6 +301,14 @@ async fn prune_airdrop_map(map: Arc<Mutex<HashMap<Address, i64>>>, timeout: i64)
|
|
|
|
|
|
async_daemonize!(realmain);
|
|
|
async fn realmain(args: Args, ex: Arc<Executor<'_>>) -> Result<()> {
|
|
|
+ if args.clock_sync {
|
|
|
+ // We verify that the system clock is valid before initializing
|
|
|
+ if (check_clock().await).is_err() {
|
|
|
+ error!("System clock is invalid, terminating...");
|
|
|
+ return Err(Error::InvalidClock)
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
// We use this handler to block this function after detaching all
|
|
|
// tasks, and to catch a shutdown signal, where we can clean up and
|
|
|
// exit gracefully.
|