const CYCLE_EPOCHS: u32 = 6; static SHUTTING_DOWN: AtomicBool = AtomicBool::new(false); static LISTENERS: Mutex<Vec<axum_server::Handle>> = Mutex::new(Vec::new()); static INDEXER: Mutex<Option<thread::JoinHandle<()>>> = Mutex::new(Option::None); fn integration_test() -> bool { env::var_os("ORD_INTEGRATION_TEST") .map(|value| value.len() > 0) .unwrap_or(false) } fn timestamp(seconds: u32) -> DateTime<Utc> { Utc.timestamp_opt(seconds.into(), 0).unwrap() } fn unbound_outpoint() -> OutPoint { OutPoint { txid: Hash::all_zeros(), vout: 0, } } fn gracefully_shutdown_indexer() { if let Some(indexer) = INDEXER.lock().unwrap().take() { // We explicitly set this to true to notify the thread to not take on new work SHUTTING_DOWN.store(true, atomic::Ordering::Relaxed); log::info!("Waiting for index thread to finish..."); if indexer.join().is_err() { log::warn!("Index thread panicked; join failed"); } } } pub fn main() { env_logger::init(); ctrlc::set_handler(move || {
Inscription number 44,981,386
Genesis block 819,057
File type text
File size 1.01 KB
Creation date Nov 30,2023 1:16 am