Merge rust-bitcoin/rust-bitcoin#7116: primitives: Correct error messages
What changed, and why it matters
This commit only fixes the wording of two user-facing error messages in the rust-bitcoin library. One message now correctly says an outpoint string is too long instead of incorrectly blaming the vout digit count. The other renames 'witness_root' to 'witness root' for consistency. There are no code logic, parsing, or cryptographic changes, and no security impact.
No security action needed; treat as a routine documentation/message-quality fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch is purely cosmetic: it updates doc comments and Display strings for ParseOutPointError::TooLong and InvalidBlockError::InvalidWitnessCommitment. No validation logic, length checks, hash comparisons, or control flow are altered. The 75-character outpoint length limit and witness commitment verification behavior remain unchanged.
Changed components
primitives/src/block.rsprimitives/src/transaction.rsInspect captured patch +9 / −4
### primitives/src/block.rs
@@ -1137,7 +1137,8 @@ pub mod error {
pub enum InvalidBlockError {
/// Header Merkle root does not match the calculated Merkle root.
InvalidMerkleRoot,
- /// The witness commitment in coinbase transaction does not match the calculated `witness_root`.
+ /// The witness commitment in the coinbase transaction does not match the calculated
+ /// witness root.
InvalidWitnessCommitment,
/// Block has no transactions (missing coinbase).
NoTransactions,
@@ -1158,7 +1159,10 @@ pub mod error {
match self {
Self::InvalidMerkleRoot =>
write!(f, "header Merkle root does not match the calculated Merkle root"),
- Self::InvalidWitnessCommitment => write!(f, "the witness commitment in coinbase transaction does not match the calculated witness_root"),
+ Self::InvalidWitnessCommitment => write!(
+ f,
+ "the witness commitment in the coinbase transaction does not match the calculated witness root"
+ ),
Self::NoTransactions => write!(f, "block has no transactions (missing coinbase)"),
Self::InvalidCoinbase =>
write!(f, "the first transaction is not a valid coinbase transaction"),
### primitives/src/transaction.rs
@@ -1574,7 +1574,8 @@ pub mod error {
Vout(parse_int::ParseIntError),
/// Error in general format.
Format,
- /// Size exceeds max.
+ /// String is longer than 75 characters (a 64 character txid, a colon, and a vout of at
+ /// most 10 digits).
TooLong,
/// Vout part is not strictly numeric without leading zeroes.
VoutNotCanonical,
@@ -1596,7 +1597,7 @@ pub mod error {
Self::Txid(ref e) => write_err!(f, "error parsing TXID"; e),
Self::Vout(ref e) => write_err!(f, "error parsing vout"; e),
Self::Format => write!(f, "OutPoint not in <txid>:<vout> format"),
- Self::TooLong => write!(f, "vout should be at most 10 digits"),
+ Self::TooLong => write!(f, "outpoint string is longer than 75 characters"),
Self::VoutNotCanonical => write!(f, "no leading zeroes or + allowed in vout part"),
}
}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.