Skip to content

Commit

Permalink
Refactor domain snap-sync
Browse files Browse the repository at this point in the history
  • Loading branch information
shamil-gadelshin committed Nov 7, 2024
1 parent cb158d1 commit b9fbdc3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions domains/client/domain-operator/src/snap_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ use std::sync::Arc;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use subspace_sync::snap_sync_engine::SnapSyncingEngine;
use tokio::sync::broadcast;
use tokio::sync::broadcast::{Receiver, Sender};
use tokio::time::sleep;
use tracing::{debug, error, trace, Instrument};

/// Notification with number of the block that is about to be imported and acknowledgement sender
/// that can be used to pause block production if desired.
/// that pauses block production until the previous block is acknowledged.

#[derive(Debug, Clone)]
pub struct BlockImportingAcknowledgement<Block>
where
Expand Down Expand Up @@ -62,7 +62,7 @@ where

/// Synchronizes consensus and domain chain snap sync.
pub struct SnapSyncOrchestrator {
consensus_snap_sync_target_block_tx: Sender<BlockNumber>,
consensus_snap_sync_target_block_tx: broadcast::Sender<BlockNumber>,
domain_snap_sync_finished: Arc<AtomicBool>,
}

Expand Down Expand Up @@ -102,7 +102,7 @@ impl SnapSyncOrchestrator {
}

/// Subscribes to a channel to receive target block numbers for consensus chain snap sync.
pub fn consensus_snap_sync_target_block_receiver(&self) -> Receiver<BlockNumber> {
pub fn consensus_snap_sync_target_block_receiver(&self) -> broadcast::Receiver<BlockNumber> {
self.consensus_snap_sync_target_block_tx.subscribe()
}

Expand Down

0 comments on commit b9fbdc3

Please sign in to comment.