Skip to main content

BlockScanner

Struct BlockScanner 

Source
pub struct BlockScanner { /* private fields */ }
Expand description

Scans transactions for Silent Payment outputs addressed to the receiver.

Holds the receiver’s scan secret key, spend public key, and optional labels. For each transaction, computes the ECDH shared secret and checks P2TR outputs for matches.

Non-SP transactions (no P2TR outputs, no eligible inputs) return an empty Vec without error – the receiver simply skips them.

Implementations§

Source§

impl BlockScanner

Source

pub fn new( scan_secret: ScanSecretKey, spend_pubkey: SpendPublicKey, labels: LabelManager, ) -> BlockScanner

Create a new scanner for the given receiver keys and labels.

Source

pub fn scan_transaction( &self, tx: &Transaction, prevouts: &[TxOut], secp: &Secp256k1<All>, ) -> Result<Vec<DetectedOutput>, ReceiveError>

Scan a single transaction for SP payments addressed to this receiver.

Returns detected outputs with their tweaks and optional label indices. Returns an empty Vec for non-SP transactions (no P2TR outputs or no eligible inputs). This is not an error – receivers scan all transactions and skip non-matching ones.

§Arguments
  • tx – The transaction to scan.
  • prevouts – Previous outputs for each input (same order as tx.input).
  • secp – Secp256k1 context for EC operations.
§Errors

Returns ReceiveError::Scanning if bdk-sp’s output scanning fails (should not happen with well-formed transactions).

Source

pub fn scan_secret(&self) -> &ScanSecretKey

Access the scan secret key (for testing/debugging).

Source

pub fn spend_pubkey(&self) -> &SpendPublicKey

Access the spend public key (for testing/debugging).

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

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.