diff --git a/indexer/service/protocol/src/convert.rs b/indexer/service/protocol/src/convert.rs index ec85d7fb..39958271 100644 --- a/indexer/service/protocol/src/convert.rs +++ b/indexer/service/protocol/src/convert.rs @@ -302,7 +302,7 @@ impl From for PrivacyPre .into_iter() .map(|(n, d)| (n.into(), d.into())) .collect(), - validity_window: ValidityWindow((validity_window.from(), validity_window.to())), + validity_window: validity_window.into(), } } } @@ -341,7 +341,6 @@ impl TryFrom for nssa::privacy_preserving_transaction: .map(|(n, d)| (n.into(), d.into())) .collect(), validity_window: validity_window - .0 .try_into() .map_err(|e| nssa::error::NssaError::InvalidInput(format!("{e}")))?, }) @@ -688,3 +687,21 @@ impl From for common::HashType { Self(value.0) } } + +// ============================================================================ +// ValidityWindow conversions +// ============================================================================ + +impl From for ValidityWindow { + fn from(value: nssa_core::program::ValidityWindow) -> Self { + Self((value.from(), value.to())) + } +} + +impl TryFrom for nssa_core::program::ValidityWindow { + type Error = nssa_core::program::InvalidWindow; + + fn try_from(value: ValidityWindow) -> Result { + value.0.try_into() + } +}