Struct DebugTxoProof

Source
pub struct DebugTxoProof(pub TxoProof);
Expand description

A debug wrapper around a TxoProof

Tuple Fields§

§0: TxoProof

Methods from Deref<Target = TxoProof>§

Source

pub fn verify( &self, block_height: u32, block_header: &Header, external_block_hash: Option<&BlockHash>, prev_filter_header: &FilterHeader, outpoint_watches: &[OutPoint], secp: &Secp256k1<All>, ) -> Result<(), VerifyError>

Verify the proof. For each of the watched outpoints, check that it was proven as unspent or that a matched spending transaction was included in the SPV sub-proof. For each matched transaction, also check that its outputs were proven as unspent or that a further spending transaction was included in the SPV sub-proof.

After calling this, you can securely use [get_spending_transaction()] for outputs in [outpoint_watches] or for outputs of matched spending transactions.

external_block_hash is the block hash of the block that was provided externally to the proof. It must be provided iff the proof is an external block proof.

Correctness argument:

  • the attestation proves that the block hash was the tip of the chain at the time of the attestation
  • the attestation covers the compact filter
  • if there is a false positive, the whole block is included, and it can be verified via its hash
  • if a spending transaction is omitted, a watched outpoint will match the compact filter and verification will fail
  • if an incorrect spending transaction is included, the SPV proof will fail
Source

pub fn filter_header(&self) -> FilterHeader

Get the filter header for the block

Source

pub fn spending_transaction(&self, outpoint: &OutPoint) -> Option<Transaction>

Get the matched transaction that spends this outpoint, if it is spent in the block. You must call [verify()] first.

Trait Implementations§

Source§

impl Debug for DebugTxoProof

Source§

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

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

impl Decodable for DebugTxoProof

Source§

fn consensus_decode<D: Read + ?Sized>(d: &mut D) -> Result<Self, Error>

Decode an object with a well-defined format. Read more
Source§

fn consensus_decode_from_finite_reader<R>(reader: &mut R) -> Result<Self, Error>
where R: Read + ?Sized,

Decode Self from a size-limited reader. Read more
Source§

impl Deref for DebugTxoProof

Source§

type Target = TxoProof

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

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> AsAny for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Source§

fn type_name(&self) -> &'static str

Gets the type name of self
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> Downcast for T
where T: AsAny + ?Sized,

Source§

fn is<T>(&self) -> bool
where T: AsAny,

Returns true if the boxed type is the same as T. Read more
Source§

fn downcast_ref<T>(&self) -> Option<&T>
where T: AsAny,

Forward to the method defined on the type Any.
Source§

fn downcast_mut<T>(&mut self) -> Option<&mut T>
where T: AsAny,

Forward to the method defined on the type Any.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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