Skip to main content

SpendOutcome

Enum SpendOutcome 

Source
pub enum SpendOutcome {
    Pending,
    Submitted,
    Confirmed {
        height: u32,
        coin_id: String,
    },
    Failed {
        stage: SpendFailureStage,
        reason: String,
    },
    Unresolved {
        reason: String,
    },
}
Expand description

Where one automated spend got to.

Internally tagged on state, so a row is {"state":"confirmed","height":…,"coin_id":"…"}.

§Two shape rules, each from a measured money-lie

  1. Confirmed carries its evidence inside the variant. There is no optional height field to fill in optimistically, so a row cannot hold a confirmation height without a confirmation.
  2. Unresolved is NOT a kind of failure. “The node signed and does not know how it ended” is not “it did not happen”: money may well have moved, and saying failed about a spend that landed is the same class of lie as claiming an unconfirmed success. A client that maps it onto failed to keep a two-state UI has chosen the wrong UI.

Variants§

§

Pending

Recorded, not yet handed to the network. Written before the producer may sign.

§

Submitted

A signed bundle was accepted by the mempool. NOT a claim that it will confirm.

§

Confirmed

The chain shows the coin this spend created.

Fields

§height: u32

The height the created coin was confirmed at.

§coin_id: String

The coin the spend CREATED — the reference a person can paste into an explorer.

§

Failed

The attempt ended in a failure this node observed.

This is not uniformly a claim that the money stayed put. Only SpendFailureStage::Signing carries that claim; at Broadcast and Confirmation a signed bundle already existed and the outcome is genuinely UNKNOWN. Ask SpendFailureStage::money_may_have_moved before rendering any failed row as settled.

Fields

§stage: SpendFailureStage

Which step failed — and, through SpendFailureStage::money_may_have_moved, whether this row claims the money is untouched or merely records where the attempt died.

§reason: String

One line a person can act on. “Insufficient funds” is the difference between a broken node and a wallet that needs topping up.

§

Unresolved

The node signed and does not know how it ended — a timeout, a restart mid-flight, or a producer that dropped the spend.

Fields

§reason: String

Why the outcome is unknown.

Implementations§

Source§

impl SpendOutcome

Source

pub const fn token(&self) -> &'static str

The stable lowercase token, matching the state tag and the status filter.

Source

pub fn outcome_is_unknown(&self) -> bool

Is what happened to the money still UNKNOWN?

True for Unresolved, and true for a Failed row whose stage may have moved money. Those two are the rows a person still has to chase, and a UI grouping them with settled failures hides exactly the spends worth looking at.

Pending and Submitted are NOT unknown outcomes — they are outcomes that have not happened yet, and the node expects to learn them. Conflating “in flight” with “lost track of” would raise an alarm about every spend in progress.

Trait Implementations§

Source§

impl Clone for SpendOutcome

Source§

fn clone(&self) -> SpendOutcome

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SpendOutcome

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for SpendOutcome

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for SpendOutcome

Source§

impl PartialEq for SpendOutcome

Source§

fn eq(&self, other: &SpendOutcome) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for SpendOutcome

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for SpendOutcome

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.