mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 21:41:12 +00:00
Run offchain workers at hash, not number. (#4878)
* Run offchain workers at particular hash, not number. * Don't run if not new best. * Don't run if not new best. * Update client/service/src/builder.rs Co-Authored-By: Nikolay Volf <nikvolf@gmail.com> * Update client/service/src/builder.rs Co-Authored-By: Nikolay Volf <nikvolf@gmail.com> * Update client/service/src/builder.rs Co-authored-by: Nikolay Volf <nikvolf@gmail.com>
This commit is contained in:
@@ -898,16 +898,24 @@ ServiceBuilder<
|
||||
}
|
||||
|
||||
let offchain = offchain.as_ref().and_then(|o| o.upgrade());
|
||||
if let Some(offchain) = offchain {
|
||||
let future = offchain.on_block_imported(
|
||||
¬ification.header,
|
||||
network_state_info.clone(),
|
||||
is_validator
|
||||
);
|
||||
let _ = to_spawn_tx_.unbounded_send((
|
||||
Box::pin(future),
|
||||
From::from("offchain-on-block")
|
||||
));
|
||||
match offchain {
|
||||
Some(offchain) if notification.is_new_best => {
|
||||
let future = offchain.on_block_imported(
|
||||
¬ification.header,
|
||||
network_state_info.clone(),
|
||||
is_validator,
|
||||
);
|
||||
let _ = to_spawn_tx_.unbounded_send((
|
||||
Box::pin(future),
|
||||
From::from("offchain-on-block"),
|
||||
));
|
||||
},
|
||||
Some(_) => log::debug!(
|
||||
target: "sc_offchain",
|
||||
"Skipping offchain workers for non-canon block: {:?}",
|
||||
notification.header,
|
||||
),
|
||||
_ => {},
|
||||
}
|
||||
|
||||
ready(())
|
||||
|
||||
Reference in New Issue
Block a user