Skip to content

Commit 47d76be

Browse files
committed
Also persist epoch to custody_count in CustodyContext
1 parent 522e00f commit 47d76be

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

beacon_node/beacon_chain/src/validator_custody.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,13 @@ impl CustodyContext {
163163
validator_custody_count: AtomicU64::new(ssz_context.validator_custody_at_head),
164164
current_is_supernode: is_supernode,
165165
persisted_is_supernode: ssz_context.persisted_is_supernode,
166-
validator_registrations: Default::default(),
166+
validator_registrations: RwLock::new(ValidatorRegistrations {
167+
validators: Default::default(),
168+
epoch_validator_custody_requirements: ssz_context
169+
.epoch_validator_custody_requirements
170+
.into_iter()
171+
.collect(),
172+
}),
167173
}
168174
}
169175

@@ -265,13 +271,21 @@ pub struct CustodyCountChanged {
265271
pub struct CustodyContextSsz {
266272
validator_custody_at_head: u64,
267273
persisted_is_supernode: bool,
274+
epoch_validator_custody_requirements: Vec<(Epoch, u64)>,
268275
}
269276

270277
impl From<&CustodyContext> for CustodyContextSsz {
271278
fn from(context: &CustodyContext) -> Self {
272279
CustodyContextSsz {
273280
validator_custody_at_head: context.validator_custody_count.load(Ordering::Relaxed),
274281
persisted_is_supernode: context.persisted_is_supernode,
282+
epoch_validator_custody_requirements: context
283+
.validator_registrations
284+
.read()
285+
.epoch_validator_custody_requirements
286+
.iter()
287+
.map(|(epoch, count)| (*epoch, *count))
288+
.collect(),
275289
}
276290
}
277291
}

0 commit comments

Comments
 (0)