What changed, and why it matters
This commit simply deletes an unused internal Rust macro called impl_consensus_encoding. The macro was only used to implement old Bitcoin consensus serialization traits, which are also being removed. There is no security issue here—this is ordinary cleanup of dead code.
No action required. This is a benign refactoring/cleanup commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch removes the impl_consensus_encoding macro from bitcoin/src/internal_macros.rs. The macro generated boilerplate Encodable and Decodable trait implementations for structs by iterating over their fields. Because the old consensus traits and their implementations are being deleted elsewhere, this macro is no longer referenced and is removed. No functional behavior changes; no new code is introduced.
Changed components
bitcoin/src/internal_macros.rsInspect captured patch +0 / −39
diff --git a/bitcoin/src/internal_macros.rs b/bitcoin/src/internal_macros.rs
index ba194195..8799185e 100644
--- a/bitcoin/src/internal_macros.rs
+++ b/bitcoin/src/internal_macros.rs
@@ -4,45 +4,6 @@
//!
//! Macros meant to be used inside the Rust Bitcoin library.
-macro_rules! impl_consensus_encoding {
- ($thing:ident, $($field:ident),+) => (
- impl $crate::consensus::Encodable for $thing {
- #[inline]
- fn consensus_encode<W: $crate::io::Write + ?Sized>(
- &self,
- w: &mut W,
- ) -> core::result::Result<usize, $crate::io::Error> {
- let mut len = 0;
- $(len += self.$field.consensus_encode(w)?;)+
- Ok(len)
- }
- }
-
- impl $crate::consensus::Decodable for $thing {
-
- #[inline]
- fn consensus_decode_from_finite_reader<R: $crate::io::BufRead + ?Sized>(
- r: &mut R,
- ) -> core::result::Result<$thing, $crate::consensus::encode::Error> {
- Ok($thing {
- $($field: $crate::consensus::Decodable::consensus_decode_from_finite_reader(r)?),+
- })
- }
-
- #[inline]
- fn consensus_decode<R: $crate::io::BufRead + ?Sized>(
- r: &mut R,
- ) -> core::result::Result<$thing, $crate::consensus::encode::Error> {
- let mut r = $crate::io::Read::take(r, crate::ToU64::to_u64($crate::consensus::encode::MAX_VEC_SIZE));
- Ok($thing {
- $($field: $crate::consensus::Decodable::consensus_decode(&mut r)?),+
- })
- }
- }
- );
-}
-pub(crate) use impl_consensus_encoding;
-
macro_rules! only_doc_attrs {
({}, {$($fun:tt)*}) => {
$($fun)*
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.