Improve ControlBlock serialize rustdoc
What changed, and why it matters
This commit only changes documentation comments (rustdoc) for a serialization function in the Taproot control block code. It rewords the explanation to remove the term 'varint' and clarify that the length prefix is added later when encoding as a witness element. No code logic was modified.
No security action needed. This is a documentation-only wording improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies only rustdoc comments above ControlBlock::serialize() in bitcoin/src/taproot/mod.rs. It removes the phrase ‘varint prefix’ and replaces it with ‘length prefix’, clarifying that the returned serialization lacks the prefix and that it is added during witness element encoding. The actual serialize() implementation and all surrounding code remain unchanged.
Changed components
bitcoin/src/taproot/mod.rs documentation onlyInspect captured patch +4 / −3
diff --git a/bitcoin/src/taproot/mod.rs b/bitcoin/src/taproot/mod.rs
index 9b25e2cd..2eb0c922 100644
--- a/bitcoin/src/taproot/mod.rs
+++ b/bitcoin/src/taproot/mod.rs
@@ -1278,9 +1278,10 @@ impl<Branch: AsRef<TaprootMerkleBranch> + ?Sized> ControlBlock<Branch> {
/// Serializes the control block.
///
- /// This would be required when using [`ControlBlock`] as a witness element while spending an
- /// output via script path. This serialization does not include the varint prefix that would be
- /// applied when encoding this element as a witness.
+ /// This is required when using [`ControlBlock`] as a witness element while spending an output
+ /// via a script path. This serialization does not include the length prefix. When the
+ /// serialization returned by this function is later encoded as a witness element the length
+ /// prefix is added.
pub fn serialize(&self) -> Vec<u8> {
let mut buf = Vec::with_capacity(self.size());
self.encode(&mut buf).expect("writers don't error");
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.