psbt: Remove noisy paths in error inner types
What changed, and why it matters
This commit is a cosmetic code cleanup in the rust-bitcoin library. It replaces fully written-out module paths (like `crate::Txid`) with shorter imported names (like `Txid`) in the PSBT error definitions. The commit message and diff show no functional changes—only style improvements.
No action needed. This is a non-functional style refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change modifies bitcoin/src/psbt/error.rs to add imports (key, ecdsa, taproot, Txid, OutPoint) and use terse type names in the Error enum variants and doc comments. The public API types remain the same; only the internal spelling of paths changed. Stats are +9/-9, consistent with a pure refactor.
Changed components
bitcoin/src/psbt/error.rsInspect captured patch +9 / −9
diff --git a/bitcoin/src/psbt/error.rs b/bitcoin/src/psbt/error.rs
index 6095c85f..c2745e59 100644
--- a/bitcoin/src/psbt/error.rs
+++ b/bitcoin/src/psbt/error.rs
@@ -9,7 +9,7 @@ use crate::bip32::Xpub;
use crate::consensus::encode;
use crate::prelude::Box;
use crate::psbt::raw;
-use crate::transaction::Transaction;
+use crate::{key, ecdsa, taproot, Txid, Transaction, OutPoint};
/// Enum for marking psbt hash error.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
@@ -80,26 +80,26 @@ pub enum Error {
NegativeFee,
/// Integer overflow in fee calculation
FeeOverflow,
- /// Non-witness UTXO (which is a complete transaction) has [`crate::Txid`] that
+ /// Non-witness UTXO (which is a complete transaction) has `Txid` that
/// does not match the transaction input.
IncorrectNonWitnessUtxo {
/// The index of the input in question.
index: usize,
/// The outpoint of the input, as it appears in the unsigned transaction.
- input_outpoint: crate::OutPoint,
- /// The ['crate::Txid`] of the non-witness UTXO.
- non_witness_utxo_txid: crate::Txid,
+ input_outpoint: OutPoint,
+ /// The [`Txid`] of the non-witness UTXO.
+ non_witness_utxo_txid: Txid,
},
/// Parsing error indicating invalid public keys
- InvalidPublicKey(crate::crypto::key::FromSliceError),
+ InvalidPublicKey(key::FromSliceError),
/// Parsing error indicating invalid secp256k1 public keys
InvalidSecp256k1PublicKey(secp256k1::Error),
/// Parsing error indicating invalid xonly public keys
InvalidXOnlyPublicKey,
/// Parsing error indicating invalid ECDSA signatures
- InvalidEcdsaSignature(crate::crypto::ecdsa::DecodeError),
+ InvalidEcdsaSignature(ecdsa::DecodeError),
/// Parsing error indicating invalid Taproot signatures
- InvalidTaprootSignature(crate::crypto::taproot::SigFromSliceError),
+ InvalidTaprootSignature(taproot::SigFromSliceError),
/// Parsing error indicating invalid control block
InvalidControlBlock,
/// Parsing error indicating invalid leaf version
@@ -107,7 +107,7 @@ pub enum Error {
/// Parsing error indicating a Taproot error
Taproot(&'static str),
/// Taproot tree deserialization error
- TapTree(crate::taproot::IncompleteBuilderError),
+ TapTree(taproot::IncompleteBuilderError),
/// Error related to an xpub key
XPubKey(&'static str),
/// Error related to PSBT version
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.