diff --git a/src/components/abciapp/src/abci/mod.rs b/src/components/abciapp/src/abci/mod.rs index a73e3021b..507078bd1 100644 --- a/src/components/abciapp/src/abci/mod.rs +++ b/src/components/abciapp/src/abci/mod.rs @@ -15,11 +15,15 @@ use { config::abci::{global_cfg::CFG, ABCIConfig}, futures::executor::ThreadPool, lazy_static::lazy_static, + ledger::converter::{LOWLEVEL_DATA_MAX, LOWLEVEL_DATA_MIN}, ruc::*, std::{ env, fs, mem, net::SocketAddr, - sync::{atomic::AtomicBool, Arc}, + sync::{ + atomic::{AtomicBool, Ordering}, + Arc, + }, thread, }, }; @@ -46,6 +50,8 @@ pub fn run() -> Result<()> { env::set_var("BNC_DATA_DIR", format!("{}/__bnc__", &config.ledger_dir)); + LOWLEVEL_DATA_MIN.swap(CFG.checkpoint.lowlevel_data_min as i64, Ordering::Relaxed); + LOWLEVEL_DATA_MAX.swap(CFG.checkpoint.lowlevel_data_max as i64, Ordering::Relaxed); if CFG.enable_query_service { env::set_var("FINDORAD_KEEP_HIST", "1"); } diff --git a/src/components/abciapp/src/abci/server/callback/mod.rs b/src/components/abciapp/src/abci/server/callback/mod.rs index 88768a43a..d0747bcf2 100644 --- a/src/components/abciapp/src/abci/server/callback/mod.rs +++ b/src/components/abciapp/src/abci/server/callback/mod.rs @@ -86,6 +86,7 @@ pub fn info(s: &mut ABCISubmissionServer, req: &RequestInfo) -> ResponseInfo { let h = state.get_tendermint_height() as i64; TENDERMINT_BLOCK_HEIGHT.swap(h, Ordering::Relaxed); LEDGER_TENDERMINT_BLOCK_HEIGHT.swap(h, Ordering::Relaxed); + resp.set_last_block_height(h); if 0 < h { if CFG.checkpoint.disable_evm_block_height < h diff --git a/src/ledger/src/converter/mod.rs b/src/ledger/src/converter/mod.rs index dfef04679..08526f293 100644 --- a/src/ledger/src/converter/mod.rs +++ b/src/ledger/src/converter/mod.rs @@ -12,20 +12,24 @@ use { fp_types::{crypto::MultiSigner, H160}, ruc::*, serde::{Deserialize, Serialize}, - std::sync::atomic::Ordering, + std::sync::atomic::{AtomicI64, Ordering}, zei::xfr::{ sig::XfrPublicKey, structs::{AssetType, XfrAmount, XfrAssetType}, }, }; +#[allow(missing_docs)] +pub static LOWLEVEL_DATA_MIN: AtomicI64 = AtomicI64::new(0); +#[allow(missing_docs)] +pub static LOWLEVEL_DATA_MAX: AtomicI64 = AtomicI64::new(0); #[inline(always)] fn is_empty(x: &Option>) -> bool { - let td_height = LEDGER_TENDERMINT_BLOCK_HEIGHT.load(Ordering::Relaxed) as u64; + let td_height = LEDGER_TENDERMINT_BLOCK_HEIGHT.load(Ordering::Relaxed); + let lowlevel_data_min = LOWLEVEL_DATA_MIN.load(Ordering::Relaxed); + let lowlevel_data_max = LOWLEVEL_DATA_MAX.load(Ordering::Relaxed); - if td_height > CFG.checkpoint.lowlevel_data_min - && td_height < CFG.checkpoint.lowlevel_data_max - { + if td_height > lowlevel_data_min && td_height < lowlevel_data_max { match x { Some(v) => !v.is_empty(), None => false,