Add comments to new_witness_program_unchecked about duplicates
What changed, and why it matters
This commit only adds plain-text comments to three copies of the same internal helper function, reminding future developers that the copies should be kept in sync. No code behavior was changed, so it has no security effect on its own.
No action needed; this is a non-functional documentation commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change is a documentation-only patch adding one-line comments to new_witness_program_unchecked in addresses/src/lib.rs, bitcoin/src/blockdata/script/mod.rs, and primitives/src/script/mod.rs. The function signatures, visibility, generics, and bodies are untouched. There is no functional or security-relevant modification.
Changed components
addresses/src/lib.rsbitcoin/src/blockdata/script/mod.rsprimitives/src/script/mod.rsInspect captured patch +3 / −0
diff --git a/addresses/src/lib.rs b/addresses/src/lib.rs
index 8f07f860..c2aa966d 100644
--- a/addresses/src/lib.rs
+++ b/addresses/src/lib.rs
@@ -123,6 +123,7 @@ mod sealed {
/// Does not do any checks on version or program length.
///
/// Convenience method used by `new_p2a`, `new_p2wpkh`, `new_p2wsh`, `new_p2tr`, and `new_p2tr_tweaked`.
+// This function is duplicated in bitcoin and primitives. If you make any changes, please update all three.
#[cfg(feature = "alloc")]
fn new_witness_program_unchecked<T: AsRef<PushBytes>, Tg>(
version: WitnessVersion,
diff --git a/bitcoin/src/blockdata/script/mod.rs b/bitcoin/src/blockdata/script/mod.rs
index 6aa07881..e6ac5d32 100644
--- a/bitcoin/src/blockdata/script/mod.rs
+++ b/bitcoin/src/blockdata/script/mod.rs
@@ -205,6 +205,7 @@ fn opcode_to_verify(opcode: Option<Opcode>) -> Option<Opcode> {
/// Does not do any checks on version or program length.
///
/// Convenience method used by `new_p2a`, `new_p2wpkh`, `new_p2wsh`, `new_p2tr`, and `new_p2tr_tweaked`.
+// This function is duplicated in addresses and primitives. If you make any changes, please update all three.
pub(crate) fn new_witness_program_unchecked<T: AsRef<PushBytes>, Tg>(
version: WitnessVersion,
program: T,
diff --git a/primitives/src/script/mod.rs b/primitives/src/script/mod.rs
index dbd027ee..70fde405 100644
--- a/primitives/src/script/mod.rs
+++ b/primitives/src/script/mod.rs
@@ -97,6 +97,7 @@ pub(crate) const P2A_PROGRAM: [u8; 2] = [78, 115];
/// Does not do any checks on version or program length.
///
/// Convenience method used by `new_p2a`, `new_p2wpkh`, `new_p2wsh`, `new_p2tr`, and `new_p2tr_tweaked`.
+// This function is duplicated in addresses and bitcoin. If you make any changes, please update all three.
pub(crate) fn new_witness_program_unchecked<T: AsRef<PushBytes>, Tg>(
version: WitnessVersion,
program: T,
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.