primitives: Document check_witness_commitment
What changed, and why it matters
This commit only adds documentation comments to an existing Rust function. It explains what the function returns and how that return value can be reused. No code behavior was changed, so there is no security impact.
No action needed; this is a documentation-only change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff converts an ordinary inline comment above check_witness_commitment into a structured rustdoc comment with a # Returns section and an intra-doc link to Block<Unchecked>::assume_checked. The function signature and implementation are untouched.
Changed components
primitives/src/block.rsInspect captured patch +7 / −1
diff --git a/primitives/src/block.rs b/primitives/src/block.rs
index d3c49484..17886907 100644
--- a/primitives/src/block.rs
+++ b/primitives/src/block.rs
@@ -185,7 +185,13 @@ impl Block<Unchecked> {
}
/// Checks if witness commitment in coinbase matches the transaction list.
- // Returns the Merkle root if it was computed (so it can be cached in `assume_checked`).
+ ///
+ /// # Returns
+ ///
+ /// Returns the Merkle root if it was computed. This can then be passed into [`assume_checked`] to
+ /// save re-calculating it.
+ ///
+ /// [`assume_checked`]: Block<Unchecked>::assume_checked
pub fn check_witness_commitment(&self) -> (bool, Option<WitnessMerkleNode>) {
if self.transactions.is_empty() {
return (false, None);
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.