sync

Function sync 

Source
pub async fn sync<P, W>(
    client: CompactTxStreamerClient<UnderlyingService>,
    consensus_parameters: &P,
    wallet: Arc<Mutex<W>>,
    sync_mode: Arc<AtomicU8>,
    config: SyncConfig,
) -> Result<SyncResult, SyncError<W::Error>>
Expand description

Syncs a wallet to the latest state of the blockchain.

sync_mode is intended to be stored in a struct that owns the wallet(s) (i.e. lightclient) and has a non-atomic counterpart crate::wallet::SyncMode. The sync engine will set the sync_mode to Running at the start of sync. However, the consumer is required to set the sync_mode back to NotRunning when sync is succussful or returns an error. This allows more flexibility and safety with sync task handles etc. sync_mode may also be set to Paused externally to pause scanning so the wallet lock can be acquired multiple times in quick sucession without the sync engine interrupting. Setting sync_mode back to Running will resume scanning. Setting sync_mode to Shutdown will stop the sync process.