mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-08 03:01:12 -04:00
fix(rpc): remove invalid block hash variant (#2954)
This commit is contained in:
@@ -91,7 +91,6 @@ impl ForkchoiceStatus {
|
||||
// This is only returned on `newPayload` accepted would be a valid state here.
|
||||
ForkchoiceStatus::Valid
|
||||
}
|
||||
PayloadStatusEnum::InvalidBlockHash { .. } => ForkchoiceStatus::Invalid,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,12 +323,7 @@ impl Serialize for PayloadStatus {
|
||||
|
||||
impl From<PayloadError> for PayloadStatusEnum {
|
||||
fn from(error: PayloadError) -> Self {
|
||||
match error {
|
||||
error @ PayloadError::BlockHash { .. } => {
|
||||
PayloadStatusEnum::InvalidBlockHash { validation_error: error.to_string() }
|
||||
}
|
||||
_ => PayloadStatusEnum::Invalid { validation_error: error.to_string() },
|
||||
}
|
||||
PayloadStatusEnum::Invalid { validation_error: error.to_string() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -356,10 +351,6 @@ pub enum PayloadStatusEnum {
|
||||
/// ACCEPTED is returned by the engine API in the following calls:
|
||||
/// - newPayloadV1: if the payload was accepted, but not processed (side chain)
|
||||
Accepted,
|
||||
InvalidBlockHash {
|
||||
#[serde(rename = "validationError")]
|
||||
validation_error: String,
|
||||
},
|
||||
}
|
||||
|
||||
impl PayloadStatusEnum {
|
||||
@@ -370,14 +361,12 @@ impl PayloadStatusEnum {
|
||||
PayloadStatusEnum::Invalid { .. } => "INVALID",
|
||||
PayloadStatusEnum::Syncing => "SYNCING",
|
||||
PayloadStatusEnum::Accepted => "ACCEPTED",
|
||||
PayloadStatusEnum::InvalidBlockHash { .. } => "INVALID_BLOCK_HASH",
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the validation error if the payload status is invalid.
|
||||
pub fn validation_error(&self) -> Option<&str> {
|
||||
match self {
|
||||
PayloadStatusEnum::InvalidBlockHash { validation_error } |
|
||||
PayloadStatusEnum::Invalid { validation_error } => Some(validation_error),
|
||||
_ => None,
|
||||
}
|
||||
@@ -397,11 +386,6 @@ impl PayloadStatusEnum {
|
||||
pub fn is_invalid(&self) -> bool {
|
||||
matches!(self, PayloadStatusEnum::Invalid { .. })
|
||||
}
|
||||
|
||||
/// Returns true if the payload status is invalid block hash.
|
||||
pub fn is_invalid_block_hash(&self) -> bool {
|
||||
matches!(self, PayloadStatusEnum::InvalidBlockHash { .. })
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for PayloadStatusEnum {
|
||||
@@ -412,11 +396,6 @@ impl std::fmt::Display for PayloadStatusEnum {
|
||||
f.write_str(": ")?;
|
||||
f.write_str(validation_error.as_str())
|
||||
}
|
||||
PayloadStatusEnum::InvalidBlockHash { validation_error } => {
|
||||
f.write_str(self.as_str())?;
|
||||
f.write_str(": ")?;
|
||||
f.write_str(validation_error.as_str())
|
||||
}
|
||||
_ => f.write_str(self.as_str()),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user