pub struct RoundState { /* private fields */ }Expand description
State of the progress of a round participation
An instance of this struct is kept all the way from the intention of joining the next round, until either the round fully confirms or it fails and we are sure it won’t have any effect on our wallet.
As soon as we have signed forfeit txs for the round, we keep track of this round attempt until we see another attempt we participated in confirm or we gain confidence that the failed attempt will never confirm.
Implementations§
Source§impl RoundState
impl RoundState
Sourcepub fn participation(&self) -> &RoundParticipation
pub fn participation(&self) -> &RoundParticipation
Our participation in this round
pub fn flow(&self) -> &RoundFlowState
pub fn unconfirmed_rounds(&self) -> &[UnconfirmedRound]
Sourcepub fn ongoing_participation(&self) -> bool
pub fn ongoing_participation(&self) -> bool
Whether the interactive part of the round is still ongoing
Sourcepub async fn try_cancel(&mut self, wallet: &Wallet) -> Result<bool>
pub async fn try_cancel(&mut self, wallet: &Wallet) -> Result<bool>
Tries to cancel the round and returns whether it was succesfully canceled or if it was already canceled or failed
Sourcepub async fn process_event(
&mut self,
wallet: &Wallet,
event: &RoundEvent,
) -> bool
pub async fn process_event( &mut self, wallet: &Wallet, event: &RoundEvent, ) -> bool
Processes the given event and returns true if some update was made to the state
Sourcepub async fn sync(&mut self, wallet: &Wallet) -> Result<RoundStatus>
pub async fn sync(&mut self, wallet: &Wallet) -> Result<RoundStatus>
Sync the round’s status and return it
When success or failure is returned, the round state can be eliminated
Sourcepub fn output_vtxos(&self) -> Option<&[Vtxo]>
pub fn output_vtxos(&self) -> Option<&[Vtxo]>
Once we know the signed round funding tx, this returns the output VTXOs for this round.
Sourcepub fn locked_pending_inputs(&self) -> &[Vtxo]
pub fn locked_pending_inputs(&self) -> &[Vtxo]
Returns the input VTXOs that are locked in this round, but only if no output VTXOs were issued yet.
Trait Implementations§
Source§impl<'a> From<&'a RoundState> for SerdeRoundState<'a>
impl<'a> From<&'a RoundState> for SerdeRoundState<'a>
Source§fn from(state: &'a RoundState) -> Self
fn from(state: &'a RoundState) -> Self
Source§impl<'a> From<SerdeRoundState<'a>> for RoundState
impl<'a> From<SerdeRoundState<'a>> for RoundState
Source§fn from(state: SerdeRoundState<'a>) -> Self
fn from(state: SerdeRoundState<'a>) -> Self
Auto Trait Implementations§
impl Freeze for RoundState
impl RefUnwindSafe for RoundState
impl Send for RoundState
impl Sync for RoundState
impl Unpin for RoundState
impl UnwindSafe for RoundState
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
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>
T in a tonic::Request