Fix attestation prod. target roots change

This commit is contained in:
Paul Hauner
2019-08-10 17:47:34 +10:00
parent 963fb7bc87
commit 04bef689e3
3 changed files with 50 additions and 15 deletions

View File

@@ -194,7 +194,7 @@ where
if let BlockProcessingOutcome::Processed { block_root } = outcome {
head_block_root = Some(block_root);
self.add_free_attestations(&attestation_strategy, &new_state, block_root);
self.add_free_attestations(&attestation_strategy, &new_state, block_root, slot);
} else {
panic!("block should be successfully processed: {:?}", outcome);
}
@@ -282,14 +282,20 @@ where
attestation_strategy: &AttestationStrategy,
state: &BeaconState<E>,
head_block_root: Hash256,
head_block_slot: Slot,
) {
self.get_free_attestations(attestation_strategy, state, head_block_root)
.into_iter()
.for_each(|attestation| {
self.chain
.process_attestation(attestation)
.expect("should process attestation");
});
self.get_free_attestations(
attestation_strategy,
state,
head_block_root,
head_block_slot,
)
.into_iter()
.for_each(|attestation| {
self.chain
.process_attestation(attestation)
.expect("should process attestation");
});
}
/// Generates a `Vec<Attestation>` for some attestation strategy and head_block.
@@ -298,6 +304,7 @@ where
attestation_strategy: &AttestationStrategy,
state: &BeaconState<E>,
head_block_root: Hash256,
head_block_slot: Slot,
) -> Vec<Attestation<E>> {
let spec = &self.spec;
let fork = &state.fork;
@@ -322,7 +329,12 @@ where
if attesting_validators.contains(validator_index) {
let data = self
.chain
.produce_attestation_data_for_block(cc.shard, head_block_root, state)
.produce_attestation_data_for_block(
cc.shard,
head_block_root,
head_block_slot,
state,
)
.expect("should produce attestation data");
let mut aggregation_bits = BitList::with_capacity(committee_size).unwrap();