]> Untitled Git - bdk/commitdiff
docs(chain): document that `apply_block` trusts the given block
author志宇 <hello@evanlinjin.me>
Wed, 14 Oct 2026 04:48:48 +0000 (04:48 +0000)
committer志宇 <hello@evanlinjin.me>
Wed, 14 Oct 2026 04:49:34 +0000 (04:49 +0000)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
crates/chain/src/indexed_tx_graph.rs

index 4bc4230731401dcd1b00619887f868ae9d82cec1..9f61788df7252e1b1a2b6417861c28d3a7bdff97 100644 (file)
@@ -364,6 +364,10 @@ where
     /// Relevancy is determined by the internal [`Indexer::is_tx_relevant`] implementation of `I`.
     /// A transaction that conflicts with a relevant transaction is also considered relevant.
     /// Irrelevant transactions in `block` will be ignored.
+    ///
+    /// The caller must supply a valid block at `height` from a trusted source. This method does not
+    /// validate the block: neither the header's place in the chain nor that `block.txdata` matches
+    /// the header's merkle root.
     pub fn apply_block_relevant(
         &mut self,
         block: &Block,
@@ -399,6 +403,10 @@ where
     ///
     /// To only insert relevant transactions, use [`apply_block_relevant`] instead.
     ///
+    /// The caller must supply a valid block at `height` from a trusted source. This method does not
+    /// validate the block: neither the header's place in the chain nor that `block.txdata` matches
+    /// the header's merkle root.
+    ///
     /// [`apply_block_relevant`]: IndexedTxGraph::apply_block_relevant
     pub fn apply_block(&mut self, block: Block, height: u32) -> ChangeSet<A, I::ChangeSet> {
         let block_id = BlockId {