Skip to content

Commit

Permalink
feat: add ExecutionPayloadFieldV2 into ExecutionPayload (#1858)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Dec 28, 2024
1 parent 2eba04a commit cfcde06
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/rpc-types-engine/src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ impl ExecutionPayloadFieldV2 {
Self::V2(payload) => payload.payload_inner,
}
}

/// Converts this payload variant into the corresponding [ExecutionPayload]
pub fn into_payload(self) -> ExecutionPayload {
match self {
Self::V1(payload) => ExecutionPayload::V1(payload),
Self::V2(payload) => ExecutionPayload::V2(payload),
}
}
}

/// This is the input to `engine_newPayloadV2`, which may or may not have a withdrawals field.
Expand Down Expand Up @@ -830,6 +838,12 @@ impl From<ExecutionPayloadV2> for ExecutionPayload {
}
}

impl From<ExecutionPayloadFieldV2> for ExecutionPayload {
fn from(payload: ExecutionPayloadFieldV2) -> Self {
payload.into_payload()
}
}

impl From<ExecutionPayloadV3> for ExecutionPayload {
fn from(payload: ExecutionPayloadV3) -> Self {
Self::V3(payload)
Expand Down

0 comments on commit cfcde06

Please sign in to comment.