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
impl BlockScanner
Sourcepub fn new(
scan_secret: ScanSecretKey,
spend_pubkey: SpendPublicKey,
labels: LabelManager,
) -> BlockScanner
pub fn new( scan_secret: ScanSecretKey, spend_pubkey: SpendPublicKey, labels: LabelManager, ) -> BlockScanner
Create a new scanner for the given receiver keys and labels.
Sourcepub fn scan_transaction(
&self,
tx: &Transaction,
prevouts: &[TxOut],
secp: &Secp256k1<All>,
) -> Result<Vec<DetectedOutput>, ReceiveError>
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 astx.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).
Sourcepub fn scan_secret(&self) -> &ScanSecretKey
pub fn scan_secret(&self) -> &ScanSecretKey
Access the scan secret key (for testing/debugging).
Sourcepub fn spend_pubkey(&self) -> &SpendPublicKey
pub fn spend_pubkey(&self) -> &SpendPublicKey
Access the spend public key (for testing/debugging).