pub struct ExitVtxo { /* private fields */ }Expand description
Tracks the exit lifecycle for a single Vtxo.
An ExitVtxo maintains:
- the underlying Vtxo being exited,
- the set of related onchain transaction IDs in topographical order,
- the current state ExitState,
- and a history of prior states for debugging and auditing.
Use ExitVtxo::progress to drive the state machine forward. The method is idempotent and will only persist when a logical state transition occurs.
Implementations§
Source§impl ExitVtxo
impl ExitVtxo
Sourcepub fn from_parts(
vtxo: Vtxo,
txids: Vec<Txid>,
state: ExitState,
history: Vec<ExitState>,
) -> Self
pub fn from_parts( vtxo: Vtxo, txids: Vec<Txid>, state: ExitState, history: Vec<ExitState>, ) -> Self
Reconstruct an ExitVtxo from its parts.
Useful when loading a tracked exit from storage.
Sourcepub fn history(&self) -> &Vec<ExitState>
pub fn history(&self) -> &Vec<ExitState>
Returns the history of the exit machine in the order that states were observed.
Sourcepub fn txids(&self) -> &Vec<Txid>
pub fn txids(&self) -> &Vec<Txid>
Returns the set of exit-related transaction IDs, these may not be broadcast yet.
Sourcepub fn is_claimable(&self) -> bool
pub fn is_claimable(&self) -> bool
True if the exit is currently ExitState::Claimable and can be claimed/spent.
Sourcepub async fn progress(
&mut self,
chain_source: &ChainSource,
tx_manager: &mut ExitTransactionManager,
persister: &dyn BarkPersister,
onchain: &mut dyn ExitUnilaterally,
fee_rate_override: Option<FeeRate>,
) -> Result<(), ExitError>
pub async fn progress( &mut self, chain_source: &ChainSource, tx_manager: &mut ExitTransactionManager, persister: &dyn BarkPersister, onchain: &mut dyn ExitUnilaterally, fee_rate_override: Option<FeeRate>, ) -> Result<(), ExitError>
Advances the exit state machine for this Vtxo.
The method:
- Attempts to transition the unilateral exit state machine.
- Persists only when a logical state change occurs.
Returns:
Ok(())when no more immediate work is required, such as when we’re waiting for a confirmation or when the exit is complete.Err(ExitError)when an unrecoverable issue occurs, such as requiring more onchain funds or if an exit transaction fails to broadcast; if the error includes a newer state, it will be committed before returning.
Notes:
- If
fee_rate_overrideisNone, a suitable fee rate will be calculated.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ExitVtxo
impl RefUnwindSafe for ExitVtxo
impl Send for ExitVtxo
impl Sync for ExitVtxo
impl Unpin for ExitVtxo
impl UnwindSafe for ExitVtxo
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request