primitives: Remove BlockTime decoder from root export
What changed, and why it matters
This commit is a routine cleanup of the public API surface. It stops two internal helper types (BlockTimeDecoder and BlockTimeDecoderError) from being exported at the top level of the primitives crate. The types are still available inside the crate where they are actually used. There is no security fix here and no indication of a vulnerability.
No security action needed. Treat as a normal semver-aware API change; downstream users relying on bitcoin_primitives::BlockTimeDecoder should switch to bitcoin_primitives::time::BlockTimeDecoder.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch removes BlockTimeDecoder and BlockTimeDecoderError from the root re-export list in bitcoin_primitives. It updates the public API snapshot files and an API test, and changes primitives/src/block.rs to import those types directly from crate::time instead of through the crate root. This is purely an API ergonomics/consistency change; the decoder types remain defined and accessible via bitcoin_primitives::time.
Changed components
bitcoin_primitives public API exportsprimitives/src/lib.rsprimitives/src/block.rsprimitives/tests/api.rsapi/primitives/*.txt snapshot filesInspect captured patch +5 / −10
diff --git a/api/primitives/all-features.txt b/api/primitives/all-features.txt
index c1361632..fab86e39 100644
--- a/api/primitives/all-features.txt
+++ b/api/primitives/all-features.txt
@@ -2124,8 +2124,6 @@ pub use bitcoin_primitives::BlockHeightInterval
pub use bitcoin_primitives::BlockMtp
pub use bitcoin_primitives::BlockMtpInterval
pub use bitcoin_primitives::BlockTime
-pub use bitcoin_primitives::BlockTimeDecoder
-pub use bitcoin_primitives::BlockTimeDecoderError
pub use bitcoin_primitives::FeeRate
pub use bitcoin_primitives::NumOpResult
pub use bitcoin_primitives::Sequence
diff --git a/api/primitives/alloc-only.txt b/api/primitives/alloc-only.txt
index dc3dc482..818a94a9 100644
--- a/api/primitives/alloc-only.txt
+++ b/api/primitives/alloc-only.txt
@@ -1863,8 +1863,6 @@ pub use bitcoin_primitives::BlockHeightInterval
pub use bitcoin_primitives::BlockMtp
pub use bitcoin_primitives::BlockMtpInterval
pub use bitcoin_primitives::BlockTime
-pub use bitcoin_primitives::BlockTimeDecoder
-pub use bitcoin_primitives::BlockTimeDecoderError
pub use bitcoin_primitives::FeeRate
pub use bitcoin_primitives::NumOpResult
pub use bitcoin_primitives::Sequence
diff --git a/api/primitives/no-features.txt b/api/primitives/no-features.txt
index 9a811381..bbe56c0c 100644
--- a/api/primitives/no-features.txt
+++ b/api/primitives/no-features.txt
@@ -762,8 +762,6 @@ pub use bitcoin_primitives::BlockHeightInterval
pub use bitcoin_primitives::BlockMtp
pub use bitcoin_primitives::BlockMtpInterval
pub use bitcoin_primitives::BlockTime
-pub use bitcoin_primitives::BlockTimeDecoder
-pub use bitcoin_primitives::BlockTimeDecoderError
pub use bitcoin_primitives::FeeRate
pub use bitcoin_primitives::NumOpResult
pub use bitcoin_primitives::Sequence
diff --git a/primitives/src/block.rs b/primitives/src/block.rs
index 26a2a62e..5b12751a 100644
--- a/primitives/src/block.rs
+++ b/primitives/src/block.rs
@@ -29,10 +29,12 @@ use crate::pow::{CompactTargetDecoder, CompactTargetDecoderError};
#[cfg(feature = "alloc")]
use crate::prelude::Vec;
#[cfg(feature = "alloc")]
+use crate::time::{BlockTimeDecoder, BlockTimeDecoderError};
+#[cfg(feature = "alloc")]
use crate::transaction::{TxMerkleNodeDecoder, TxMerkleNodeDecoderError};
use crate::{BlockTime, CompactTarget, TxMerkleNode};
#[cfg(feature = "alloc")]
-use crate::{BlockTimeDecoder, BlockTimeDecoderError, Transaction, WitnessMerkleNode};
+use crate::{Transaction, WitnessMerkleNode};
#[rustfmt::skip] // Keep public re-exports separate.
#[doc(inline)]
diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs
index e95963c7..27ab5028 100644
--- a/primitives/src/lib.rs
+++ b/primitives/src/lib.rs
@@ -62,7 +62,7 @@ pub use units::{
parse_int,
result::{self, NumOpResult},
sequence::{self, Sequence},
- time::{self, BlockTime, BlockTimeDecoder, BlockTimeDecoderError},
+ time::{self, BlockTime},
weight::{self, Weight},
};
diff --git a/primitives/tests/api.rs b/primitives/tests/api.rs
index f1cf4ee0..2635cbcb 100644
--- a/primitives/tests/api.rs
+++ b/primitives/tests/api.rs
@@ -213,8 +213,7 @@ fn api_can_use_units_modules_from_crate_root() {
fn api_can_use_units_types_from_crate_root() {
use bitcoin_primitives::{
Amount, BlockHeight, BlockHeightInterval, BlockMtp, BlockMtpInterval, BlockTime,
- BlockTimeDecoder, BlockTimeDecoderError, FeeRate, NumOpResult, Sequence, SignedAmount,
- Weight,
+ FeeRate, NumOpResult, Sequence, SignedAmount, Weight,
};
}
Why this scored 19/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.