use std::io::BufReader;
use std::ops::Deref;
use std::sync::Arc;
+use bitcoin::blockdata::constants::ChainHash;
use lightning::log_info;
use lightning::routing::gossip::{NetworkGraph, NodeId};
pub mod types;
+#[cfg(test)]
+mod tests;
+
/// The purpose of this prefix is to identify the serialization format, should other rapid gossip
/// sync formats arise in the future.
///
}
});
+ #[cfg(test)]
+ {
+ let schema_name = tests::db_test_schema();
+ let schema_creation_command = format!("CREATE SCHEMA IF NOT EXISTS {}", schema_name);
+ client.execute(&schema_creation_command, &[]).await.unwrap();
+ client.execute(&format!("SET search_path TO {}", schema_name), &[]).await.unwrap();
+ }
+
client.execute("set time zone UTC", &[]).await.unwrap();
client
}
let mut blob = GOSSIP_PREFIX.to_vec();
let network = config::network();
- let genesis_block = bitcoin::blockdata::constants::genesis_block(network);
- let chain_hash = genesis_block.block_hash();
+ let chain_hash = ChainHash::using_genesis_block(network);
chain_hash.write(&mut blob).unwrap();
let blob_timestamp = Snapshotter::<Arc<RGSSLogger>>::round_down_to_nearest_multiple(current_timestamp, SYMLINK_GRANULARITY_INTERVAL as u64) as u32;