mirror of
https://github.com/sigp/lighthouse.git
synced 2026-07-05 05:44:30 +00:00
Fix execution payload request block prod code path
This commit is contained in:
@@ -474,6 +474,7 @@ pub enum RequestsError {
|
||||
InvalidOrdering,
|
||||
InvalidPrefix(u8),
|
||||
DecodeError(String),
|
||||
VariantMismatch,
|
||||
}
|
||||
|
||||
/// Format of `ExecutionRequests` received over the engine api.
|
||||
@@ -606,6 +607,28 @@ impl<E: EthSpec> TryFrom<JsonExecutionRequests> for ExecutionRequests<E> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> TryFrom<JsonExecutionRequests> for ExecutionRequestsElectra<E> {
|
||||
type Error = RequestsError;
|
||||
|
||||
fn try_from(value: JsonExecutionRequests) -> Result<Self, Self::Error> {
|
||||
match ExecutionRequests::<E>::try_from(value)? {
|
||||
ExecutionRequests::Electra(requests) => Ok(requests),
|
||||
ExecutionRequests::Gloas(_) => Err(RequestsError::VariantMismatch),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> TryFrom<JsonExecutionRequests> for ExecutionRequestsGloas<E> {
|
||||
type Error = RequestsError;
|
||||
|
||||
fn try_from(value: JsonExecutionRequests) -> Result<Self, Self::Error> {
|
||||
match ExecutionRequests::<E>::try_from(value)? {
|
||||
ExecutionRequests::Gloas(requests) => Ok(requests),
|
||||
ExecutionRequests::Electra(_) => Err(RequestsError::VariantMismatch),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[superstruct(
|
||||
variants(Bellatrix, Capella, Deneb, Electra, Fulu, Gloas),
|
||||
variant_attributes(
|
||||
|
||||
Reference in New Issue
Block a user