From 2db8d12b0eb865a5499404b982dbb07681bac8ea Mon Sep 17 00:00:00 2001 From: topologoanatom Date: Tue, 10 Feb 2026 14:07:30 +0200 Subject: [PATCH] add clone bound to `Jet` --- src/bit_encoding/decode.rs | 4 ++-- src/jet/mod.rs | 2 +- src/node/commit.rs | 2 +- src/node/construct.rs | 2 +- src/node/redeem.rs | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bit_encoding/decode.rs b/src/bit_encoding/decode.rs index fc89e9a4..e45c79b3 100644 --- a/src/bit_encoding/decode.rs +++ b/src/bit_encoding/decode.rs @@ -153,7 +153,7 @@ impl DagLike for (usize, &'_ [DecodeNode]) { } } -pub fn decode_expression<'brand, I: Iterator, J: Jet>( +pub fn decode_expression<'brand, I: Iterator + Clone, J: Jet>( ctx: &types::Context<'brand>, bits: &mut BitIter, ) -> Result, Error> { @@ -237,7 +237,7 @@ pub fn decode_expression<'brand, I: Iterator, J: Jet>( /// Decode a single Simplicity node from bits and /// insert it into a hash map at its index for future reference by ancestor nodes. -fn decode_node, J: Jet>( +fn decode_node + Clone, J: Jet>( bits: &mut BitIter, index: usize, ) -> Result, Error> { diff --git a/src/jet/mod.rs b/src/jet/mod.rs index 085b0d12..af4f9bac 100644 --- a/src/jet/mod.rs +++ b/src/jet/mod.rs @@ -77,7 +77,7 @@ pub trait Jet: fn encode(&self, w: &mut BitWriter) -> std::io::Result; /// Decode a jet from bits. - fn decode>(bits: &mut BitIter) -> Result; + fn decode + Clone>(bits: &mut BitIter) -> Result; /// Obtains a C FFI compatible environment for the jet. fn c_jet_env(env: &Self::Environment) -> &Self::CJetEnvironment; diff --git a/src/node/commit.rs b/src/node/commit.rs index 64a89836..8c940db7 100644 --- a/src/node/commit.rs +++ b/src/node/commit.rs @@ -251,7 +251,7 @@ impl CommitNode { /// or the witness is provided by other means. /// /// If the serialization contains the witness data, then use [`RedeemNode::decode()`]. - pub fn decode>(bits: BitIter) -> Result, DecodeError> { + pub fn decode + Clone>(bits: BitIter) -> Result, DecodeError> { use crate::decode; // 1. Decode program with out witnesses. diff --git a/src/node/construct.rs b/src/node/construct.rs index eda9b366..35017545 100644 --- a/src/node/construct.rs +++ b/src/node/construct.rs @@ -229,7 +229,7 @@ impl<'brand, J: Jet> ConstructNode<'brand, J> { /// or the witness is provided by other means. /// /// If the serialization contains the witness data, then use [`crate::RedeemNode::decode()`]. - pub fn decode>( + pub fn decode + Clone>( context: &types::Context<'brand>, mut bits: BitIter, ) -> Result, crate::decode::Error> { diff --git a/src/node/redeem.rs b/src/node/redeem.rs index aa0bf45e..7629e9e5 100644 --- a/src/node/redeem.rs +++ b/src/node/redeem.rs @@ -464,8 +464,8 @@ impl RedeemNode { mut witness: BitIter, ) -> Result, DecodeError> where - I1: Iterator, - I2: Iterator, + I1: Iterator + Clone, + I2: Iterator + Clone, { // 0. Set up a type to help with the call to `convert` below struct DecodeFinalizer<'bits, J: Jet, I: Iterator> {