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: &BlockHeader, 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
§

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

§

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, 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.