pub enum CanonicalReason<A> {
Anchor {
anchor: A,
descendant: Option<Txid>,
},
ObservedIn {
observed_in: ObservedIn,
descendant: Option<Txid>,
},
}
Expand description
The reason why a transaction is canonical.
Variants§
Anchor
This transaction is anchored in the best chain by A
, and therefore canonical.
Fields
anchor: A
The anchor that anchored the transaction in the chain.
ObservedIn
This transaction does not conflict with any other transaction with a more recent
ObservedIn
value or one that is anchored in the best chain.
Fields
observed_in: ObservedIn
The ObservedIn
value of the transaction.
descendant: Option<Txid>
Whether the ObservedIn
value is of the transaction’s descendant.
Implementations§
Source§impl<A: Clone> CanonicalReason<A>
impl<A: Clone> CanonicalReason<A>
Sourcepub fn from_anchor(anchor: A) -> Self
pub fn from_anchor(anchor: A) -> Self
Constructs a CanonicalReason
from an anchor
.
Sourcepub fn from_observed_in(observed_in: ObservedIn) -> Self
pub fn from_observed_in(observed_in: ObservedIn) -> Self
Constructs a CanonicalReason
from an observed_in
value.
Sourcepub fn to_transitive(&self, descendant: Txid) -> Self
pub fn to_transitive(&self, descendant: Txid) -> Self
Contruct a new CanonicalReason
from the original which is transitive to descendant
.
This signals that either the ObservedIn
or Anchor
value belongs to the transaction’s
descendant, but is transitively relevant.
Sourcepub fn descendant(&self) -> &Option<Txid>
pub fn descendant(&self) -> &Option<Txid>
This signals that either the ObservedIn
or Anchor
value belongs to the transaction’s
descendant.
Trait Implementations§
Source§impl<A: Clone> Clone for CanonicalReason<A>
impl<A: Clone> Clone for CanonicalReason<A>
Source§fn clone(&self) -> CanonicalReason<A>
fn clone(&self) -> CanonicalReason<A>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more