Make Verifier::verify mutable (#3165)

* Make Verifier::verify mutable

* Fix GrandPa tests

* Fix doctest

* Fix more doctests
This commit is contained in:
Pierre Krieger
2019-08-07 21:21:44 +02:00
committed by Gavin Wood
parent f11291cd9a
commit 97febf4c30
11 changed files with 102 additions and 72 deletions
+2 -2
View File
@@ -624,7 +624,7 @@ impl<B: BlockT, C> Verifier<B> for BabeVerifier<C> where
C::Api: BlockBuilderApi<B> + BabeApi<B>,
{
fn verify(
&self,
&mut self,
origin: BlockOrigin,
header: B::Header,
justification: Option<Justification>,
@@ -1182,7 +1182,7 @@ pub fn import_queue<B, E, Block: BlockT<Hash=H256>, I, RA, PRA>(
let timestamp_core = verifier.time_source.clone();
let queue = BasicQueue::new(
Arc::new(verifier),
verifier,
Box::new(block_import.clone()),
justification_import,
finality_proof_import,
+4 -4
View File
@@ -97,7 +97,7 @@ impl Verifier<TestBlock> for TestVerifier {
/// new set of validators to import. If not, err with an Error-Message
/// presented to the User in the logs.
fn verify(
&self,
&mut self,
origin: BlockOrigin,
mut header: TestHeader,
justification: Option<Justification>,
@@ -124,7 +124,7 @@ impl TestNetFactory for BabeTestNet {
/// KLUDGE: this function gets the mutator from thread-local storage.
fn make_verifier(&self, client: PeersClient, _cfg: &ProtocolConfig)
-> Arc<Self::Verifier>
-> Self::Verifier
{
let api = client.as_full().expect("only full clients are used in test");
trace!(target: "babe", "Creating a verifier");
@@ -137,7 +137,7 @@ impl TestNetFactory for BabeTestNet {
).expect("Registers babe inherent data provider");
trace!(target: "babe", "Provider registered");
Arc::new(TestVerifier {
TestVerifier {
inner: BabeVerifier {
api,
inherent_data_providers,
@@ -145,7 +145,7 @@ impl TestNetFactory for BabeTestNet {
time_source: Default::default(),
},
mutator: MUTATOR.with(|s| s.borrow().clone()),
})
}
}
fn peer(&mut self, i: usize) -> &mut Peer<Self::PeerData, DummySpecialization> {