Skip to main content

Reason

Enum Reason 

Source
pub enum Reason {
Show 24 variants BadVersion { word: u32, }, BadVarint, Truncated { needed: u64, }, BadFlag { byte: u8, }, TreeHeightOver64 { height: u8, }, TreeHeightZero, OffsetOutsideTree { level: u8, offset: u64, }, NoTxidAtLevelZero, MissingSibling { level: u8, offset: u64, }, MismatchedNode { level: u8, offset: u64, }, RootNotCarried { height: u64, root: [u8; 32], }, BumpIndexNamesNoBump { index: u64, }, TxidNotInBump { index: u64, txid: [u8; 32], }, InputNamesNoElement { txid: [u8; 32], }, StubNotProven { txid: [u8; 32], }, TrailingBytes, SubjectMissing { subject: [u8; 32], }, UnrelatedTransaction { txid: [u8; 32], }, NoInputs, NoOutputs, UnprovenCoinbase, NullOutpoint, DuplicateInput, ValueOutOfRange,
}
Expand description

A refusal’s reason with its data, the Lean’s Reason.

Variants§

§

BadVersion

The version word read.

Fields

§word: u32

The word, little-endian.

§

BadVarint

A varint cut short or encoded non-canonically.

§

Truncated

A fixed-width field cut short.

Fields

§needed: u64

The bytes that were due.

§

BadFlag

A BUMP leaf flag not 00, 01 or 02; a has-BUMP byte not 00 or 01; a V2 format byte not 0, 1 or 2.

Fields

§byte: u8

The byte read.

§

TreeHeightOver64

The tree-height byte read.

Fields

§height: u8

The byte.

§

TreeHeightZero

A tree height of 0: no level 0, no txid, no root.

§

OffsetOutsideTree

A leaf outside its level.

Fields

§level: u8

The level.

§offset: u64

The leaf’s offset.

§

NoTxidAtLevelZero

Nothing to prove.

§

MissingSibling

The node a path needs.

Fields

§level: u8

The level.

§offset: u64

The node’s offset at that level.

§

MismatchedNode

The node that disagrees.

Fields

§level: u8

The level.

§offset: u64

The node’s offset at that level.

§

RootNotCarried

The root computed and the height the BUMP claims.

Fields

§height: u64

The block height.

§root: [u8; 32]

The root, in wire order.

§

BumpIndexNamesNoBump

The index read.

Fields

§index: u64

The index.

§

TxidNotInBump

The BUMP named and the txid it does not carry.

Fields

§index: u64

The index.

§txid: [u8; 32]

The transaction’s txid.

§

InputNamesNoElement

The previous txid an input names.

Fields

§txid: [u8; 32]

The txid.

§

StubNotProven

The txid of the entry.

Fields

§txid: [u8; 32]

The txid.

§

TrailingBytes

The byte at the offset belongs to no field.

§

SubjectMissing

The subject that is not the tip.

Fields

§subject: [u8; 32]

The subject.

§

UnrelatedTransaction

The transaction nothing spends.

Fields

§txid: [u8; 32]

Its txid.

§

NoInputs

A raw transaction whose input count is 0, named at the transaction’s leading byte. It is no transaction: the node refuses one before any script runs (the sibling’s rule, bsv-script-lean lean/BsvScript/TxRules.lean, checkTransactionCommon_vinEmpty), so no block holds it, a BUMP that claims it proves nothing, and an unproven one has no input for the reader to hold it by.

§

NoOutputs

A raw transaction with at least one input and an output count of 0, named at the transaction’s leading byte. The node refuses it beside one with no input, after it (bsv-script-lean@87f0461 lean/BsvScript/TxRules.lean:86, checkTransactionCommon_voutEmpty), so a transaction with neither is Reason::NoInputs. An unproven coinbase is Reason::UnprovenCoinbase ahead of this check.

§

UnprovenCoinbase

An unproven single null-outpoint input, at the transaction’s leading byte. [SRC] sibling@87f0461 TxRules.lean:35-38,102 (#68).

§

NullOutpoint

A null outpoint in a regular transaction, at the input’s previous txid. [SRC] sibling@87f0461 TxRules.lean:31-32,107 (#68).

§

DuplicateInput

A repeated outpoint, at the repeating input’s previous txid. [SRC] sibling@87f0461 TxRules.lean:108 (#68).

§

ValueOutOfRange

An output value or running total outside MoneyRange, at the value field. [SRC] sibling@87f0461 TxRules.lean:25,88-93 (#68).

Implementations§

Source§

impl Reason

Source

pub fn kind(&self) -> Kind

The reason without its data.

Trait Implementations§

Source§

impl Clone for Reason

Source§

fn clone(&self) -> Reason

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 Reason

Source§

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

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

impl Eq for Reason

Source§

impl PartialEq for Reason

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Reason

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more