primitives: add encoder/decoder types to api.rs
What changed, and why it matters
This commit only adds new test cases to a public API surface test file. It imports recently-added encoder/decoder types from several modules to ensure they are reachable by users of the library. There is no code change to the library itself, no bug fix, and no security-related content.
No action required; this is a routine test-only API coverage update.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff extends primitives/tests/api.rs with additional use imports for new Encoder/Decoder types in the script, block, merkle_tree, transaction, and witness modules. These are compile-time API reachability tests; the commit does not modify any implementation, parsing logic, or serialization behavior.
Changed components
primitives/tests/api.rsInspect captured patch +34 / −2
diff --git a/primitives/tests/api.rs b/primitives/tests/api.rs
index 6b6605db..db50201b 100644
--- a/primitives/tests/api.rs
+++ b/primitives/tests/api.rs
@@ -288,11 +288,43 @@ fn api_can_use_all_types_from_module_locktime() {
#[test]
fn api_can_use_all_types_from_module_script() {
use bitcoin_primitives::script::{
- RedeemScriptSizeError, ScriptHash, ScriptPubKey, ScriptPubKeyBuf, ScriptSig, ScriptSigBuf,
- WScriptHash, WitnessScriptSizeError,
+ RedeemScriptSizeError, ScriptBufDecoder, ScriptBufDecoderError, ScriptEncoder, ScriptHash,
+ ScriptPubKey, ScriptPubKeyBuf, ScriptSig, ScriptSigBuf, WScriptHash,
+ WitnessScriptSizeError,
};
}
+#[test]
+fn api_can_use_all_types_from_module_block() {
+ use bitcoin_primitives::block::{
+ BlockDecoder, BlockDecoderError, BlockEncoder, BlockHashDecoder, BlockHashDecoderError,
+ BlockHashEncoder, HeaderDecoder, HeaderEncoder, VersionDecoder, VersionDecoderError,
+ VersionEncoder,
+ };
+}
+
+#[test]
+fn api_can_use_all_types_from_module_merkle_tree() {
+ use bitcoin_primitives::merkle_tree::{
+ TxMerkleNodeDecoder, TxMerkleNodeDecoderError, TxMerkleNodeEncoder,
+ };
+}
+
+#[test]
+fn api_can_use_all_types_from_module_transaction() {
+ use bitcoin_primitives::transaction::{
+ OutPointDecoder, OutPointDecoderError, OutPointEncoder, TransactionDecoder,
+ TransactionDecoderError, TransactionEncoder, TxInDecoder, TxInDecoderError, TxInEncoder,
+ TxOutDecoder, TxOutDecoderError, TxOutEncoder, VersionDecoder, VersionDecoderError,
+ VersionEncoder,
+ };
+}
+
+#[test]
+fn api_can_use_all_types_from_module_witness() {
+ use bitcoin_primitives::witness::{WitnessDecoder, WitnessDecoderError, WitnessEncoder};
+}
+
// `Debug` representation is never empty (C-DEBUG-NONEMPTY).
#[test]
fn api_all_non_error_types_have_non_empty_debug() {
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.