diff --git a/ethcore/light/src/client/cht.rs b/ethcore/light/src/cht.rs similarity index 87% rename from ethcore/light/src/client/cht.rs rename to ethcore/light/src/cht.rs index 8424e0c31..537a3ed6a 100644 --- a/ethcore/light/src/client/cht.rs +++ b/ethcore/light/src/cht.rs @@ -20,3 +20,8 @@ pub const SIZE: u64 = 2048; pub fn block_to_cht_number(block_num: u64) -> u64 { (block_num + 1) / SIZE } + +/// Get the starting block of a given CHT. +pub fn start_number(cht_num: u64) -> u64 { + (cht_num * SIZE) + 1 +} diff --git a/ethcore/light/src/client/header_chain.rs b/ethcore/light/src/client/header_chain.rs index fdb075e04..a2a953653 100644 --- a/ethcore/light/src/client/header_chain.rs +++ b/ethcore/light/src/client/header_chain.rs @@ -28,7 +28,7 @@ use std::collections::{BTreeMap, HashMap}; -use client::cht; +use cht; use ethcore::block_status::BlockStatus; use ethcore::error::BlockError; diff --git a/ethcore/light/src/client/mod.rs b/ethcore/light/src/client/mod.rs index 7d4cb0fe8..1d7821e78 100644 --- a/ethcore/light/src/client/mod.rs +++ b/ethcore/light/src/client/mod.rs @@ -39,8 +39,6 @@ use self::header_chain::HeaderChain; pub use self::service::Service; -pub mod cht; - mod header_chain; mod service; diff --git a/ethcore/light/src/lib.rs b/ethcore/light/src/lib.rs index 0e650f992..a23fd879a 100644 --- a/ethcore/light/src/lib.rs +++ b/ethcore/light/src/lib.rs @@ -33,6 +33,7 @@ #![deny(missing_docs)] pub mod client; +pub mod cht; pub mod net; pub mod on_demand;