use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use std::sync::atomic::{Ordering, AtomicBool};
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use std::sync::atomic::{Ordering, AtomicBool};
static mut DATA_STORE: Option<Box<Store>> = None;
static mut PRINTER: Option<Box<Printer>> = None;
pub static START_SHUTDOWN: AtomicBool = AtomicBool::new(false);
static mut DATA_STORE: Option<Box<Store>> = None;
static mut PRINTER: Option<Box<Printer>> = None;
pub static START_SHUTDOWN: AtomicBool = AtomicBool::new(false);
let store = unsafe { DATA_STORE.as_ref().unwrap() };
let mut scan_nodes = store.get_next_scan_nodes();
let per_iter_time = Duration::from_millis(1000 / store.get_u64(U64Setting::ConnsPerSec));
let store = unsafe { DATA_STORE.as_ref().unwrap() };
let mut scan_nodes = store.get_next_scan_nodes();
let per_iter_time = Duration::from_millis(1000 / store.get_u64(U64Setting::ConnsPerSec));
for node in scan_nodes.drain(..) {
scan_node(iter_time, node);
iter_time += per_iter_time;
}
for node in scan_nodes.drain(..) {
scan_node(iter_time, node);
iter_time += per_iter_time;
}
let store = unsafe { DATA_STORE.as_ref().unwrap() };
store.save_data().then(|_| {
if !START_SHUTDOWN.load(Ordering::Relaxed) {
let store = unsafe { DATA_STORE.as_ref().unwrap() };
store.save_data().then(|_| {
if !START_SHUTDOWN.load(Ordering::Relaxed) {
if let Err(_) = trusted_write.try_send(NetworkMessage::GetHeaders(GetHeadersMessage {
version: 70015,
locator_hashes: vec![unsafe { HIGHEST_HEADER.as_ref().unwrap() }.lock().unwrap().0.clone()],
if let Err(_) = trusted_write.try_send(NetworkMessage::GetHeaders(GetHeadersMessage {
version: 70015,
locator_hashes: vec![unsafe { HIGHEST_HEADER.as_ref().unwrap() }.lock().unwrap().0.clone()],
= (headers.last().unwrap().bitcoin_hash(), top_height);
printer.set_stat(printer::Stat::HeaderCount(top_height));
if top_height >= starting_height as u64 {
= (headers.last().unwrap().bitcoin_hash(), top_height);
printer.set_stat(printer::Stat::HeaderCount(top_height));
if top_height >= starting_height as u64 {