Skip to content

Commit

Permalink
Rename snapshot_manager
Browse files Browse the repository at this point in the history
  • Loading branch information
liuchengxu committed Dec 18, 2024
1 parent 71fa8c7 commit e9594ba
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion crates/subcoin-snapcake/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
mod cli;
mod params;
mod snapshot_processor;
mod snapshot_manager;
mod state_sync_wrapper;
mod syncing_strategy;

Expand Down Expand Up @@ -260,3 +260,4 @@ where

Ok(())
}

Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,13 @@ impl From<UtxoCsvEntry> for Utxo {
}
}

pub struct SnapshotProcessor {
pub struct SnapshotManager {
store: SnapshotStore,
snapshot_generator: UtxoSnapshotGenerator,
target_bitcoin_block_hash: BlockHash,
}

impl SnapshotProcessor {
impl SnapshotManager {
pub fn new(
target_block_number: u32,
target_bitcoin_block_hash: BlockHash,
Expand Down
12 changes: 6 additions & 6 deletions crates/subcoin-snapcake/src/state_sync_wrapper.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::snapshot_processor::SnapshotProcessor;
use crate::snapshot_manager::SnapshotManager;
use codec::Decode;
use sc_client_api::ProofProvider;
use sc_network_sync::strategy::state_sync::{
Expand All @@ -22,7 +22,7 @@ pub(crate) struct StateSyncWrapper<B: BlockT, Client> {
muhash: MuHash3072,
target_block_number: u32,
target_bitcoin_block_hash: bitcoin::BlockHash,
snapshot_processor: SnapshotProcessor,
snapshot_manager: SnapshotManager,
received_coins: usize,
total_coins: usize,
last_progress_print_time: Option<Instant>,
Expand All @@ -45,7 +45,7 @@ where
subcoin_primitives::extract_bitcoin_block_hash::<B>(&target_header)
.expect("Failed to extract bitcoin block hash");

let snapshot_processor = SnapshotProcessor::new(
let snapshot_manager = SnapshotManager::new(
target_block_number.saturated_into(),
target_bitcoin_block_hash,
snapshot_base_dir,
Expand All @@ -57,7 +57,7 @@ where
target_block_number: target_block_number.saturated_into(),
target_bitcoin_block_hash,
muhash: MuHash3072::new(),
snapshot_processor,
snapshot_manager,
received_coins: 0,
total_coins,
last_progress_print_time: None,
Expand Down Expand Up @@ -96,7 +96,7 @@ where

self.muhash.insert(&data);

self.snapshot_processor
self.snapshot_manager
.store_utxo(Utxo { txid, vout, coin });

self.received_coins += 1;
Expand All @@ -123,7 +123,7 @@ where
self.total_coins,
);

self.snapshot_processor.create_snapshot(self.total_coins);
self.snapshot_manager.create_snapshot(self.total_coins);

tracing::info!(
target: "snapcake",
Expand Down

0 comments on commit e9594ba

Please sign in to comment.