Add #[track_caller] to `FutureLeafVersion::from_consensus`
What changed, and why it matters
This commit adds a Rust compiler hint called #[track_caller] to an internal helper function. It does not change program behavior, fix a bug, or alter any security boundary. It only improves the quality of panic/error location reporting if the code ever panics.
No security action needed. Treat as a normal code-quality/diagnostics improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change annotates FutureLeafVersion::from_consensus with #[track_caller]. In Rust, this attribute propagates the caller’s location to panic messages and unwrap/expect backtraces, but it does not change control flow, error handling, or runtime semantics. The function remains pub(self) (private to the module) and still returns the same Result. There is no security-relevant code change.
Changed components
bitcoin/src/taproot/mod.rsInspect captured patch +1 / −0
diff --git a/bitcoin/src/taproot/mod.rs b/bitcoin/src/taproot/mod.rs
index 32835a4e..5d2bd872 100644
--- a/bitcoin/src/taproot/mod.rs
+++ b/bitcoin/src/taproot/mod.rs
@@ -1294,6 +1294,7 @@ impl<Branch: AsRef<TaprootMerkleBranch> + ?Sized> ControlBlock<Branch> {
pub struct FutureLeafVersion(u8);
impl FutureLeafVersion {
+ #[track_caller]
pub(self) fn from_consensus(version: u8) -> Result<Self, InvalidTaprootLeafVersionError> {
match version {
TAPROOT_LEAF_TAPSCRIPT => unreachable!(
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.