pub mod checkpoints;
pub mod filter;
pub mod genesis;
pub mod iter;
pub mod store;
pub mod time;
pub mod tree;
pub use bitcoin::blockdata::block::{Block, BlockHeader};
pub use bitcoin::blockdata::transaction::Transaction;
pub use bitcoin::hash_types::BlockHash;
pub type Target = bitcoin::util::uint::Uint256;
pub type Work = bitcoin::util::uint::Uint256;
pub type Bits = u32;
pub type Height = u64;
pub type BlockTime = u32;
pub fn locators_indexes(mut from: Height) -> Vec<Height> {
let mut indexes = Vec::new();
let mut step = 1;
while from > 0 {
if indexes.len() >= 8 {
step *= 2;
}
indexes.push(from as Height);
from = from.saturating_sub(step);
}
indexes.push(0);
indexes
}
pub fn pow_limit_bits(network: &bitcoin::Network) -> Bits {
match network {
bitcoin::Network::Bitcoin => 0x1d00ffff,
bitcoin::Network::Testnet => 0x1d00ffff,
bitcoin::Network::Regtest => 0x207fffff,
bitcoin::Network::Signet => 0x1e0377ae,
}
}