Add first implementation of optimised LMD ghost.

- Implements the optimised lmd-ghost fork choice rule.
- Removes Attestations struct.
- Removes latest_attestation_targets from beacon_chain.
This commit is contained in:
Age Manning
2019-02-12 11:49:39 +11:00
parent 4723707097
commit 405b3ff6c1
2 changed files with 170 additions and 37 deletions

View File

@@ -1,22 +0,0 @@
use std::collections::HashMap;
use types::Hash256;
pub struct AttestationTargets {
map: HashMap<u64, Hash256>,
}
impl AttestationTargets {
pub fn new() -> Self {
Self {
map: HashMap::new(),
}
}
pub fn get(&self, validator_index: u64) -> Option<&Hash256> {
self.map.get(&validator_index)
}
pub fn insert(&mut self, validator_index: u64, block_hash: Hash256) -> Option<Hash256> {
self.map.insert(validator_index, block_hash)
}
}