Restore backwards compatibility when using older BNs (#3410)
## Issue Addressed https://github.com/status-im/nimbus-eth2/issues/3930 ## Proposed Changes We can trivially support beacon nodes which do not provide the `is_optimistic` field by wrapping the field in an `Option`.
This commit is contained in:
parent
d0beecca20
commit
e24552d61a
@ -1704,7 +1704,7 @@ pub fn serve<T: BeaconChainTypes>(
|
|||||||
|
|
||||||
let syncing_data = api_types::SyncingData {
|
let syncing_data = api_types::SyncingData {
|
||||||
is_syncing: network_globals.sync_state.read().is_syncing(),
|
is_syncing: network_globals.sync_state.read().is_syncing(),
|
||||||
is_optimistic,
|
is_optimistic: Some(is_optimistic),
|
||||||
head_slot,
|
head_slot,
|
||||||
sync_distance,
|
sync_distance,
|
||||||
};
|
};
|
||||||
|
@ -1300,7 +1300,7 @@ impl ApiTester {
|
|||||||
|
|
||||||
let expected = SyncingData {
|
let expected = SyncingData {
|
||||||
is_syncing: false,
|
is_syncing: false,
|
||||||
is_optimistic: false,
|
is_optimistic: Some(false),
|
||||||
head_slot,
|
head_slot,
|
||||||
sync_distance,
|
sync_distance,
|
||||||
};
|
};
|
||||||
|
@ -552,7 +552,7 @@ pub struct VersionData {
|
|||||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct SyncingData {
|
pub struct SyncingData {
|
||||||
pub is_syncing: bool,
|
pub is_syncing: bool,
|
||||||
pub is_optimistic: bool,
|
pub is_optimistic: Option<bool>,
|
||||||
pub head_slot: Slot,
|
pub head_slot: Slot,
|
||||||
pub sync_distance: Slot,
|
pub sync_distance: Slot,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user