mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 17:26:04 +00:00
self review
This commit is contained in:
@@ -487,6 +487,23 @@ impl<'a, E: EthSpec> From<AttestationRefOnDisk<'a, E>> for AttestationRef<'a, E>
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> ForkVersionDeserialize for Attestation<E> {
|
||||
fn deserialize_by_fork<'de, D: serde::Deserializer<'de>>(
|
||||
value: serde_json::Value,
|
||||
fork_name: crate::ForkName,
|
||||
) -> Result<Self, D::Error> {
|
||||
if fork_name.electra_enabled() {
|
||||
let attestation: AttestationElectra<E> =
|
||||
serde_json::from_value(value).map_err(serde::de::Error::custom)?;
|
||||
Ok(Attestation::Electra(attestation))
|
||||
} else {
|
||||
let attestation: AttestationBase<E> =
|
||||
serde_json::from_value(value).map_err(serde::de::Error::custom)?;
|
||||
Ok(Attestation::Base(attestation))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: EthSpec> ForkVersionDeserialize for Vec<Attestation<E>> {
|
||||
fn deserialize_by_fork<'de, D: serde::Deserializer<'de>>(
|
||||
value: serde_json::Value,
|
||||
|
||||
Reference in New Issue
Block a user