Register previous rounds' votes with gossip service on startup (#2676)

* grandpa: register previous round votes with gossip service on startup

* gossip: fix tests

* grandpa: optionally register previous round votes on startup

* grandpa: fix tests
This commit is contained in:
André Silva
2019-05-26 22:05:02 +01:00
committed by Arkadiy Paronyan
parent e2d1d0c951
commit 10c1dfcffb
7 changed files with 119 additions and 19 deletions
+12 -2
View File
@@ -253,6 +253,11 @@ impl Network<Block> for MessageRouting {
})
}
fn register_gossip_message(&self, _topic: Hash, _data: Vec<u8>) {
// NOTE: only required to restore previous state on startup
// not required for tests currently
}
fn report(&self, _who: network::PeerId, _cost_benefit: i32) {
}
@@ -1242,7 +1247,12 @@ fn voter_persists_its_votes() {
name: Some(format!("peer#{}", 1)),
};
let routing = MessageRouting::new(net.clone(), 1);
let (network, routing_work) = communication::NetworkBridge::new(routing, config.clone(), Exit);
let (network, routing_work) = communication::NetworkBridge::new(
routing,
config.clone(),
None,
Exit,
);
runtime.block_on(routing_work).unwrap();
let (round_rx, round_tx) = network.round_communication(
@@ -1470,4 +1480,4 @@ fn empty_finality_proof_is_returned_to_light_client_when_authority_set_is_differ
runner_net.lock().peer(3).client().info().unwrap().chain.finalized_number,
if FORCE_CHANGE { 0 } else { 10 },
);
}
}