pub struct TimeoutPolicy { /* private fields */ }Expand description
Timeout policy. Safety rule: the EVM lock (the maker’s money) must expire well before the Zcash refund height (the taker’s money), so whoever learns the secret always has time to use it on the other chain.
The fields are private: a policy comes from MAINNET_POLICY, DEVNET_POLICY or TimeoutPolicy::new, which
validates it (assertValidPolicy), so every TimeoutPolicy is coherent and the window rule can’t be weakened by
a zero, negative, NaN or below-1 safety factor.
Implementations§
Source§impl TimeoutPolicy
impl TimeoutPolicy
Sourcepub fn new(params: TimeoutPolicyParams) -> Result<TimeoutPolicy, ParalockError>
pub fn new(params: TimeoutPolicyParams) -> Result<TimeoutPolicy, ParalockError>
A validated policy (assertValidPolicy): the four integers must be positive safe integers, safety_factor ≥ 1
(not NaN), and the policy’s own windows must pass the window rule. Fails with unsafe_timeouts and the
reference’s messages.
Sourcepub const fn zcash_lock_blocks(&self) -> u64
pub const fn zcash_lock_blocks(&self) -> u64
Blocks between funding and the taker’s Zcash refund height.
Sourcepub const fn evm_lock_seconds(&self) -> u64
pub const fn evm_lock_seconds(&self) -> u64
Seconds the maker’s EVM lock stays claimable by the taker.
Sourcepub const fn zcash_block_seconds(&self) -> u64
pub const fn zcash_block_seconds(&self) -> u64
Expected Zcash block interval, in seconds.
Sourcepub const fn min_zcash_confirmations(&self) -> u64
pub const fn min_zcash_confirmations(&self) -> u64
Confirmations the maker waits for on the Zcash funding transaction (and on its own claim).
Sourcepub const fn safety_factor(&self) -> f64
pub const fn safety_factor(&self) -> f64
The required ratio of remaining Zcash time to EVM lock time (≥ 1).
Sourcepub const fn params(&self) -> TimeoutPolicyParams
pub const fn params(&self) -> TimeoutPolicyParams
The policy’s values.
Trait Implementations§
Source§impl Clone for TimeoutPolicy
impl Clone for TimeoutPolicy
Source§fn clone(&self) -> TimeoutPolicy
fn clone(&self) -> TimeoutPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for TimeoutPolicy
Source§impl Debug for TimeoutPolicy
impl Debug for TimeoutPolicy
Source§impl PartialEq for TimeoutPolicy
impl PartialEq for TimeoutPolicy
impl StructuralPartialEq for TimeoutPolicy
Source§impl TryFrom<TimeoutPolicyParams> for TimeoutPolicy
impl TryFrom<TimeoutPolicyParams> for TimeoutPolicy
Source§type Error = ParalockError
type Error = ParalockError
Source§fn try_from(
params: TimeoutPolicyParams,
) -> Result<TimeoutPolicy, <TimeoutPolicy as TryFrom<TimeoutPolicyParams>>::Error>
fn try_from( params: TimeoutPolicyParams, ) -> Result<TimeoutPolicy, <TimeoutPolicy as TryFrom<TimeoutPolicyParams>>::Error>
Auto Trait Implementations§
impl Freeze for TimeoutPolicy
impl RefUnwindSafe for TimeoutPolicy
impl Send for TimeoutPolicy
impl Sync for TimeoutPolicy
impl Unpin for TimeoutPolicy
impl UnsafeUnpin for TimeoutPolicy
impl UnwindSafe for TimeoutPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request