Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,16 @@ impl PlatformPaymentAddressProvider {
self.last_known_recent_block = result.last_known_recent_block;
}

/// Current `last_known_recent_block` watermark.
///
/// Crate-visible mirror of the field used by the `AddressProvider`
/// trait implementation, so wallet-level helpers (notably
/// [`super::wallet::PlatformAddressWallet::sync_watermark`]) can
/// read the value without going through the trait.
pub(crate) fn last_known_recent_block(&self) -> u64 {
self.last_known_recent_block
}

/// Restore incremental-sync watermark from persisted state.
pub(crate) fn set_stored_sync_state(
&mut self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,21 @@ impl PlatformAddressWallet {
.unwrap_or_default()
}

/// Current incremental-sync watermark (`last_known_recent_block`)
/// from the unified platform-address provider.
///
/// Returns `None` when the provider hasn't been initialised yet or
/// when no incremental sync has produced a watermark. A zero-valued
/// watermark is reported as `None` to match the "no stored watermark"
/// convention used by [`Self::apply_sync_state`]. Intended for
/// progress checks where the precise "uninitialised vs. zero"
/// distinction is not material.
pub async fn sync_watermark(&self) -> Option<u64> {
let guard = self.provider.read().await;
let raw = guard.as_ref().map(|p| p.last_known_recent_block())?;
(raw > 0).then_some(raw)
Comment thread
lklimek marked this conversation as resolved.
}

/// Get total platform credits across all addresses.
///
/// Returns the sum of all cached balances.
Expand Down
Loading