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
Confirmedcarries 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.Unresolvedis 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 sayingfailedabout a spend that landed is the same class of lie as claiming an unconfirmed success. A client that maps it ontofailedto 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
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: SpendFailureStageWhich step failed — and, through SpendFailureStage::money_may_have_moved, whether
this row claims the money is untouched or merely records where the attempt died.
Unresolved
The node signed and does not know how it ended — a timeout, a restart mid-flight, or a producer that dropped the spend.
Implementations§
Source§impl SpendOutcome
impl SpendOutcome
Sourcepub const fn token(&self) -> &'static str
pub const fn token(&self) -> &'static str
The stable lowercase token, matching the state tag and the
status filter.
Sourcepub fn outcome_is_unknown(&self) -> bool
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
impl Clone for SpendOutcome
Source§fn clone(&self) -> SpendOutcome
fn clone(&self) -> SpendOutcome
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more