mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-20 22:38:34 +00:00
Fix the VoteTrackerV28 definition
This commit is contained in:
@@ -34,12 +34,12 @@ pub struct VoteTracker {
|
||||
}
|
||||
|
||||
// Can be deleted once the V28 schema migration is buried.
|
||||
// Matches the on-disk format from schema v28: current_root, next_root, next_epoch.
|
||||
#[derive(Default, PartialEq, Clone, Encode, Decode)]
|
||||
pub struct VoteTrackerV28 {
|
||||
current_root: Hash256,
|
||||
next_root: Hash256,
|
||||
current_slot: Slot,
|
||||
next_slot: Slot,
|
||||
next_epoch: Epoch,
|
||||
}
|
||||
|
||||
// This impl is only used upon upgrade from pre-Gloas to Gloas with all pre-Gloas nodes.
|
||||
@@ -49,9 +49,10 @@ impl From<VoteTrackerV28> for VoteTracker {
|
||||
VoteTracker {
|
||||
current_root: v.current_root,
|
||||
next_root: v.next_root,
|
||||
current_slot: v.current_slot,
|
||||
next_slot: v.next_slot,
|
||||
// TODO(gloas): check that this is correct
|
||||
// The v28 format stored next_epoch rather than slots. Default to 0 since the
|
||||
// vote tracker will be updated on the next attestation.
|
||||
current_slot: Slot::new(0),
|
||||
next_slot: Slot::new(0),
|
||||
current_payload_present: false,
|
||||
next_payload_present: false,
|
||||
}
|
||||
@@ -61,13 +62,14 @@ impl From<VoteTrackerV28> for VoteTracker {
|
||||
// This impl is only used upon downgrade from V29 to V28, with exclusively pre-Gloas nodes.
|
||||
impl From<VoteTracker> for VoteTrackerV28 {
|
||||
fn from(v: VoteTracker) -> Self {
|
||||
// Drop the payload_present, but this is safe because this is only called on pre-Gloas
|
||||
// Drop the payload_present fields. This is safe because this is only called on pre-Gloas
|
||||
// nodes.
|
||||
VoteTrackerV28 {
|
||||
current_root: v.current_root,
|
||||
next_root: v.next_root,
|
||||
current_slot: v.current_slot,
|
||||
next_slot: v.next_slot,
|
||||
// The v28 format stored next_epoch. Default to 0 since the vote tracker will be
|
||||
// updated on the next attestation.
|
||||
next_epoch: Epoch::new(0),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user