state_processing: sort attester slashing indices

This will be "to spec" if eth2.0-specs#1126 is merged
This commit is contained in:
Michael Sproul 2019-05-27 17:46:05 +10:00
parent f9d48dee68
commit 01039546cb
No known key found for this signature in database
GPG Key ID: 77B1309D2E54E914

View File

@ -1,6 +1,6 @@
use super::errors::{AttesterSlashingInvalid as Invalid, AttesterSlashingValidationError as Error};
use super::verify_indexed_attestation::verify_indexed_attestation;
use std::collections::HashSet;
use std::collections::BTreeSet;
use types::*;
/// Indicates if an `AttesterSlashing` is valid to be included in a block in the current epoch of the given
@ -67,13 +67,18 @@ where
let attestation_1 = &attester_slashing.attestation_1;
let attestation_2 = &attester_slashing.attestation_2;
let mut attesting_indices_1 = HashSet::new();
attesting_indices_1.extend(attestation_1.custody_bit_0_indices.clone());
attesting_indices_1.extend(attestation_1.custody_bit_1_indices.clone());
let mut attesting_indices_2 = HashSet::new();
attesting_indices_2.extend(attestation_2.custody_bit_0_indices.clone());
attesting_indices_2.extend(attestation_2.custody_bit_1_indices.clone());
let attesting_indices_1 = attestation_1
.custody_bit_0_indices
.iter()
.chain(&attestation_1.custody_bit_1_indices)
.cloned()
.collect::<BTreeSet<_>>();
let attesting_indices_2 = attestation_2
.custody_bit_0_indices
.iter()
.chain(&attestation_2.custody_bit_1_indices)
.cloned()
.collect::<BTreeSet<_>>();
let mut slashable_indices = vec![];