Finality proof: fetch new authorities set instead of previous one (#4112)

* fetch new authorities set instead of previous one

* fixed leftovers + updated test properly

* read initial authorities once

* updated comment

* fix grumbles
This commit is contained in:
Svyatoslav Nikolsky
2019-11-19 17:37:36 +03:00
committed by GitHub
parent e2e2eb7b32
commit b5f8eb5ac3
2 changed files with 88 additions and 51 deletions
@@ -687,7 +687,7 @@ pub mod tests {
#[test]
fn finality_proof_not_required_when_consensus_data_does_not_changes_and_correct_justification_provided() {
let justification = TestJustification(true, Vec::new()).encode();
let justification = TestJustification((0, vec![(AuthorityId::from_slice(&[1; 32]), 1)]), Vec::new()).encode();
assert_eq!(import_block(HashMap::new(), Some(justification)), ImportResult::Imported(ImportedAux {
clear_justification_requests: false,
needs_justification: false,
@@ -714,7 +714,7 @@ pub mod tests {
#[test]
fn finality_proof_required_when_consensus_data_changes_and_incorrect_justification_provided() {
let justification = TestJustification(false, Vec::new()).encode();
let justification = TestJustification((0, vec![]), Vec::new()).encode();
let mut cache = HashMap::new();
cache.insert(well_known_cache_keys::AUTHORITIES, vec![AuthorityId::from_slice(&[2; 32])].encode());
assert_eq!(