mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 12:47:05 +00:00
All tests bar invalid_message passing, changes might be dubious
This commit is contained in:
@@ -338,7 +338,14 @@ impl ForkChoiceTestDefinition {
|
||||
attestation_slot,
|
||||
} => {
|
||||
fork_choice
|
||||
.process_attestation(validator_index, block_root, attestation_slot, false)
|
||||
.process_attestation(
|
||||
validator_index,
|
||||
block_root,
|
||||
attestation_slot,
|
||||
false,
|
||||
false,
|
||||
MainnetEthSpec::slots_per_epoch(),
|
||||
)
|
||||
.unwrap_or_else(|_| {
|
||||
panic!(
|
||||
"process_attestation op at index {} returned error",
|
||||
@@ -359,6 +366,8 @@ impl ForkChoiceTestDefinition {
|
||||
block_root,
|
||||
attestation_slot,
|
||||
payload_present,
|
||||
true,
|
||||
MainnetEthSpec::slots_per_epoch(),
|
||||
)
|
||||
.unwrap_or_else(|_| {
|
||||
panic!(
|
||||
|
||||
@@ -594,10 +594,18 @@ impl ProtoArrayForkChoice {
|
||||
block_root: Hash256,
|
||||
attestation_slot: Slot,
|
||||
payload_present: bool,
|
||||
update_by_slot: bool,
|
||||
slots_per_epoch: u64,
|
||||
) -> Result<(), String> {
|
||||
let vote = self.votes.get_mut(validator_index);
|
||||
|
||||
if attestation_slot > vote.next_slot || *vote == VoteTracker::default() {
|
||||
let is_newer_vote = if update_by_slot {
|
||||
attestation_slot > vote.next_slot
|
||||
} else {
|
||||
attestation_slot.epoch(slots_per_epoch) > vote.next_slot.epoch(slots_per_epoch)
|
||||
};
|
||||
|
||||
if is_newer_vote || *vote == VoteTracker::default() {
|
||||
vote.next_root = block_root;
|
||||
vote.next_slot = attestation_slot;
|
||||
vote.next_payload_present = payload_present;
|
||||
|
||||
Reference in New Issue
Block a user