Skip to content

Commit

Permalink
add scan start block height config parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Alesfatalis committed Dec 22, 2023
1 parent 87d1bee commit ba89576
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions core/src/oracle_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub const DEFAULT_ORACLE_CONFIG_FILE_NAME: &str = "oracle_config.yaml";
pub struct OracleConfig {
pub node_url: Url,
pub base_fee: u64,
pub scan_start_height: u32,
pub log_level: Option<LevelFilter>,
pub core_api_port: u16,
pub oracle_address: NetworkAddress,
Expand Down Expand Up @@ -117,6 +118,7 @@ impl Default for OracleConfig {
Self {
oracle_address: address.clone(),
core_api_port: 9010,
scan_start_height: 0,
data_point_source_custom_script: None,
base_fee: *tx_builder::SUGGESTED_TX_FEE().as_u64(),
log_level: LevelFilter::Info.into(),
Expand Down
5 changes: 3 additions & 2 deletions core/src/scans/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::spec_token::PoolTokenId;
use crate::spec_token::RefreshTokenId;
use crate::spec_token::UpdateTokenId;

use crate::oracle_config::ORACLE_CONFIG;
use ::serde::Deserialize;
use ::serde::Serialize;
use once_cell::sync;
Expand Down Expand Up @@ -87,7 +88,7 @@ impl NodeScanRegistry {
buyback_token_scan,
};
registry.save_to_json_file(&get_scans_file_path())?;
node_api.rescan_from_height(0)?;
node_api.rescan_from_height(ORACLE_CONFIG.scan_start_height)?;
Ok(registry)
}

Expand Down Expand Up @@ -116,7 +117,7 @@ impl NodeScanRegistry {
} else {
let buyback_token_scan =
GenericTokenScan::register(node_api, &pool_config_buyback_token_id)?;
node_api.rescan_from_height(0)?;
node_api.rescan_from_height(ORACLE_CONFIG.scan_start_height)?;
let new_registry = Self {
buyback_token_scan: Some(buyback_token_scan),
..loaded_registry
Expand Down

0 comments on commit ba89576

Please sign in to comment.