units: remove unused fee_rate serde OverflowError
What changed, and why it matters
This commit simply deletes an unused error type called OverflowError from the fee rate serialization code. It is a cleanup change with no security impact. The type became unnecessary because the underlying constructors can no longer fail.
No action required. This is a benign API cleanup. Reviewers may want to confirm the type is not referenced elsewhere in the public API or downstream crates before release.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch removes the public fee_rate::serde::OverflowError type and its re-export, plus related test references. The commit message states this is because from_sat constructors became infallible, making the error type unused. There is no functional behavior change, no bug fix, and no security-sensitive modification.
Changed components
units/src/fee_rate/serde.rsunits/tests/api.rsInspect captured patch +0 / −41
### units/src/fee_rate/serde.rs
@@ -23,9 +23,6 @@
//! }
//! ```
-#[doc(no_inline)]
-pub use self::error::OverflowError;
-
pub mod as_sat_per_kwu_floor {
//! Serialize and deserialize [`FeeRate`] denominated in satoshis per 1000 weight units.
//!
@@ -407,35 +404,3 @@ pub mod as_sat_per_vb_ceil {
}
}
}
-
-/// Error types for fee rate serde handling.
-pub mod error {
- use core::convert::Infallible;
- use core::fmt;
-
- /// Overflow occurred while deserializing fee rate per virtual byte.
- #[derive(Debug, Clone, PartialEq, Eq)]
- #[non_exhaustive]
- pub struct OverflowError;
-
- impl From<Infallible> for OverflowError {
- #[inline]
- fn from(never: Infallible) -> Self { match never {} }
- }
-
- impl fmt::Display for OverflowError {
- #[inline]
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "overflow occurred while deserializing fee rate per virtual byte")
- }
- }
-
- #[cfg(feature = "std")]
- impl std::error::Error for OverflowError {
- #[inline]
- fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
- let Self {} = self;
- None
- }
- }
-}
### units/tests/api.rs
@@ -144,8 +144,6 @@ struct Errors {
j: amount::error::TooPreciseError,
k: amount::error::UnknownDenominationError,
l: block::TooBigForRelativeHeightError,
- #[cfg(feature = "serde")]
- m: fee_rate::serde::OverflowError,
n: locktime::absolute::ConversionError,
o: locktime::absolute::ParseHeightError,
p: locktime::absolute::ParseTimeError,
@@ -267,8 +265,6 @@ fn c_good_err_display() {
assert_display::<amount::error::TooPreciseError>();
assert_display::<amount::error::UnknownDenominationError>();
assert_display::<block::TooBigForRelativeHeightError>();
- #[cfg(feature = "serde")]
- assert_display::<fee_rate::serde::OverflowError>();
assert_display::<locktime::absolute::ConversionError>();
assert_display::<locktime::absolute::ParseHeightError>();
assert_display::<locktime::absolute::ParseTimeError>();
@@ -426,8 +422,6 @@ fn p_consistent_exports_sequence() {
/// P-CONSISTENT-EXPORTS: Tests that all types can be imported from the `fee_rate` module.
#[test]
fn p_consistent_exports_fee_rate() {
- #[cfg(feature = "serde")]
- use bitcoin_units::fee_rate::serde::OverflowError;
use bitcoin_units::fee_rate::FeeRate;
}
Why this scored 18/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.