mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 03:58:04 +00:00
on_start now returns the precise elements to request (#3003)
* on_start now returns the precise elements to request * Fix test
This commit is contained in:
committed by
Bastian Köcher
parent
d5bc7325b9
commit
a199a989b8
@@ -194,8 +194,9 @@ pub trait BlockImport<B: BlockT> {
|
||||
pub trait JustificationImport<B: BlockT> {
|
||||
type Error: ::std::error::Error + Send + 'static;
|
||||
|
||||
/// Called by the import queue when it is started.
|
||||
fn on_start(&self, _link: &mut dyn crate::import_queue::Link<B>) { }
|
||||
/// Called by the import queue when it is started. Returns a list of justifications to request
|
||||
/// from the network.
|
||||
fn on_start(&self) -> Vec<(B::Hash, NumberFor<B>)> { Vec::new() }
|
||||
|
||||
/// Import a Block justification and finalize the given block.
|
||||
fn import_justification(
|
||||
@@ -210,8 +211,9 @@ pub trait JustificationImport<B: BlockT> {
|
||||
pub trait FinalityProofImport<B: BlockT> {
|
||||
type Error: std::error::Error + Send + 'static;
|
||||
|
||||
/// Called by the import queue when it is started.
|
||||
fn on_start(&self, _link: &mut dyn crate::import_queue::Link<B>) { }
|
||||
/// Called by the import queue when it is started. Returns a list of finality proofs to request
|
||||
/// from the network.
|
||||
fn on_start(&self) -> Vec<(B::Hash, NumberFor<B>)> { Vec::new() }
|
||||
|
||||
/// Import a Block justification and finalize the given block. Returns finalized block or error.
|
||||
fn import_finality_proof(
|
||||
|
||||
@@ -267,10 +267,15 @@ impl<B: BlockT, V: 'static + Verifier<B>> BlockImportWorker<B, V> {
|
||||
};
|
||||
|
||||
if let Some(justification_import) = worker.justification_import.as_ref() {
|
||||
justification_import.on_start(&mut worker.result_sender);
|
||||
for (hash, number) in justification_import.on_start() {
|
||||
worker.result_sender.request_justification(&hash, number);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(finality_proof_import) = worker.finality_proof_import.as_ref() {
|
||||
finality_proof_import.on_start(&mut worker.result_sender);
|
||||
for (hash, number) in finality_proof_import.on_start() {
|
||||
worker.result_sender.request_finality_proof(&hash, number);
|
||||
}
|
||||
}
|
||||
|
||||
let future = futures::future::poll_fn(move || {
|
||||
|
||||
Reference in New Issue
Block a user