Skip to content

Commit 56cb158

Browse files
authored
chore(ethereum): avoid cloning requests in try_into_v4 (#19851)
1 parent c6b1a45 commit 56cb158

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/ethereum/engine-primitives/src/payload.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ impl EthBuiltPayload {
120120
/// Try converting built payload into [`ExecutionPayloadEnvelopeV4`].
121121
///
122122
/// Returns an error if the payload contains non EIP-4844 sidecar.
123-
pub fn try_into_v4(self) -> Result<ExecutionPayloadEnvelopeV4, BuiltPayloadConversionError> {
124-
Ok(ExecutionPayloadEnvelopeV4 {
125-
execution_requests: self.requests.clone().unwrap_or_default(),
126-
envelope_inner: self.try_into()?,
127-
})
123+
pub fn try_into_v4(
124+
mut self,
125+
) -> Result<ExecutionPayloadEnvelopeV4, BuiltPayloadConversionError> {
126+
let execution_requests = self.requests.take().unwrap_or_default();
127+
Ok(ExecutionPayloadEnvelopeV4 { execution_requests, envelope_inner: self.try_into()? })
128128
}
129129

130130
/// Try converting built payload into [`ExecutionPayloadEnvelopeV5`].

0 commit comments

Comments
 (0)