mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-22 19:50:37 +00:00
Add committee_len to attestation data
This commit is contained in:
commit
a952acb86f
@ -475,11 +475,7 @@ where
|
||||
/// Produce an `AttestationData` that is valid for the present `slot` and given `shard`.
|
||||
pub fn produce_attestation_data(&self, shard: u64) -> Result<AttestationData, Error> {
|
||||
trace!("BeaconChain::produce_attestation: shard: {}", shard);
|
||||
let source_epoch = self.state.read().current_justified_epoch;
|
||||
let source_root = *self.state.read().get_block_root(
|
||||
source_epoch.start_slot(self.spec.slots_per_epoch),
|
||||
&self.spec,
|
||||
)?;
|
||||
let state = self.state.read();
|
||||
|
||||
let target_root = *self.state.read().get_block_root(
|
||||
self.state
|
||||
@ -500,8 +496,8 @@ where
|
||||
epoch: self.state.read().slot.epoch(self.spec.slots_per_epoch),
|
||||
crosslink_data_root: Hash256::zero(),
|
||||
},
|
||||
source_epoch,
|
||||
source_root,
|
||||
source_epoch: state.current_justified_epoch,
|
||||
source_root: state.current_justified_root,
|
||||
})
|
||||
}
|
||||
|
||||
@ -696,7 +692,10 @@ where
|
||||
},
|
||||
};
|
||||
|
||||
trace!("BeaconChain::produce_block: updating state for new block.",);
|
||||
debug!(
|
||||
"Produced block with {} attestations, updating state.",
|
||||
block.body.attestations.len()
|
||||
);
|
||||
|
||||
per_block_processing_without_verifying_block_signature(&mut state, &block, &self.spec)?;
|
||||
|
||||
|
@ -6,5 +6,5 @@ pub struct AttestationDuty {
|
||||
pub slot: Slot,
|
||||
pub shard: Shard,
|
||||
pub committee_index: usize,
|
||||
pub comittee_size: usize,
|
||||
pub committee_len: usize,
|
||||
}
|
||||
|
@ -92,6 +92,7 @@ impl EpochCache {
|
||||
slot,
|
||||
shard,
|
||||
committee_index: k,
|
||||
committee_len: crosslink_committee.committee.len(),
|
||||
};
|
||||
attestation_duties[*validator_index] = Some(attestation_duty)
|
||||
}
|
||||
|
@ -33,9 +33,11 @@ impl BooleanBitfield {
|
||||
}
|
||||
|
||||
/// Create a new bitfield with the given length `initial_len` and all values set to `bit`.
|
||||
pub fn from_elem(inital_len: usize, bit: bool) -> Self {
|
||||
pub fn from_elem(initial_len: usize, bit: bool) -> Self {
|
||||
// BitVec can panic if we don't set the len to be a multiple of 8.
|
||||
let len = ((initial_len + 7) / 8) * 8;
|
||||
Self {
|
||||
0: BitVec::from_elem(inital_len, bit),
|
||||
0: BitVec::from_elem(len, bit),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ mod beacon_node_attestation;
|
||||
|
||||
use std::sync::Arc;
|
||||
use types::{BeaconBlock, ChainSpec, Domain, Fork, Slot};
|
||||
use super::block_proposer::beacon_node_block::BeaconNodeError;
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum Error {
|
||||
|
Loading…
Reference in New Issue
Block a user