mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 04:28:01 +00:00
Announce block after it is being enacted as new best block (#182)
This commit is contained in:
+6
-1
@@ -520,7 +520,12 @@ where
|
||||
)));
|
||||
|
||||
let follow =
|
||||
match cumulus_consensus::follow_polkadot(self.para_id, self.client, polkadot_client) {
|
||||
match cumulus_consensus::follow_polkadot(
|
||||
self.para_id,
|
||||
self.client,
|
||||
polkadot_client,
|
||||
self.announce_block.clone(),
|
||||
) {
|
||||
Ok(follow) => follow,
|
||||
Err(e) => {
|
||||
return Err(error!("Could not start following polkadot: {:?}", e));
|
||||
|
||||
@@ -104,6 +104,7 @@ pub fn follow_polkadot<L, P, Block, B>(
|
||||
para_id: ParaId,
|
||||
local: Arc<L>,
|
||||
polkadot: P,
|
||||
announce_block: Arc<dyn Fn(Block::Hash, Vec<u8>) + Send + Sync>,
|
||||
) -> ClientResult<impl Future<Output = ()> + Send + Unpin>
|
||||
where
|
||||
Block: BlockT,
|
||||
@@ -136,7 +137,7 @@ where
|
||||
.map(|_| ())
|
||||
};
|
||||
|
||||
Ok(future::select(follow_finalized, follow_new_best(para_id, local, polkadot)?).map(|_| ()))
|
||||
Ok(future::select(follow_finalized, follow_new_best(para_id, local, polkadot, announce_block)?).map(|_| ()))
|
||||
}
|
||||
|
||||
/// Follow the relay chain new best head, to update the Parachain new best head.
|
||||
@@ -144,6 +145,7 @@ fn follow_new_best<L, P, Block, B>(
|
||||
para_id: ParaId,
|
||||
local: Arc<L>,
|
||||
polkadot: P,
|
||||
announce_block: Arc<dyn Fn(Block::Hash, Vec<u8>) + Send + Sync>,
|
||||
) -> ClientResult<impl Future<Output = ()> + Send + Unpin>
|
||||
where
|
||||
Block: BlockT,
|
||||
@@ -195,6 +197,8 @@ where
|
||||
hash, err
|
||||
);
|
||||
}
|
||||
|
||||
(*announce_block)(hash, Vec::new());
|
||||
}
|
||||
Ok(BlockStatus::InChainPruned) => {
|
||||
error!(
|
||||
|
||||
Reference in New Issue
Block a user