Skip to content

Commit ba89576

Browse files
committed
add scan start block height config parameter
1 parent 87d1bee commit ba89576

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

core/src/oracle_config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pub const DEFAULT_ORACLE_CONFIG_FILE_NAME: &str = "oracle_config.yaml";
3030
pub struct OracleConfig {
3131
pub node_url: Url,
3232
pub base_fee: u64,
33+
pub scan_start_height: u32,
3334
pub log_level: Option<LevelFilter>,
3435
pub core_api_port: u16,
3536
pub oracle_address: NetworkAddress,
@@ -117,6 +118,7 @@ impl Default for OracleConfig {
117118
Self {
118119
oracle_address: address.clone(),
119120
core_api_port: 9010,
121+
scan_start_height: 0,
120122
data_point_source_custom_script: None,
121123
base_fee: *tx_builder::SUGGESTED_TX_FEE().as_u64(),
122124
log_level: LevelFilter::Info.into(),

core/src/scans/registry.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use crate::spec_token::PoolTokenId;
1010
use crate::spec_token::RefreshTokenId;
1111
use crate::spec_token::UpdateTokenId;
1212

13+
use crate::oracle_config::ORACLE_CONFIG;
1314
use ::serde::Deserialize;
1415
use ::serde::Serialize;
1516
use once_cell::sync;
@@ -87,7 +88,7 @@ impl NodeScanRegistry {
8788
buyback_token_scan,
8889
};
8990
registry.save_to_json_file(&get_scans_file_path())?;
90-
node_api.rescan_from_height(0)?;
91+
node_api.rescan_from_height(ORACLE_CONFIG.scan_start_height)?;
9192
Ok(registry)
9293
}
9394

@@ -116,7 +117,7 @@ impl NodeScanRegistry {
116117
} else {
117118
let buyback_token_scan =
118119
GenericTokenScan::register(node_api, &pool_config_buyback_token_id)?;
119-
node_api.rescan_from_height(0)?;
120+
node_api.rescan_from_height(ORACLE_CONFIG.scan_start_height)?;
120121
let new_registry = Self {
121122
buyback_token_scan: Some(buyback_token_scan),
122123
..loaded_registry

0 commit comments

Comments
 (0)