rpc: Subscribe to chainHead_unstable_body

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Alexandru Vasile
2022-11-25 18:41:44 +00:00
parent 684897f096
commit bfcdcc0ba9
+18
View File
@@ -624,6 +624,24 @@ impl<T: Config> Rpc<T> {
Ok(subscription)
}
/// Subscribe to the chain head body.
pub async fn subscribe_chainhead_body(
&self,
hash: T::Hash,
subscription_id: String,
) -> Result<Subscription<FollowEvent<T::Hash>>, Error> {
let subscription = self
.client
.subscribe(
"chainHead_unstable_body",
rpc_params![subscription_id, hash],
"chainHead_unstable_stopBody",
)
.await?;
Ok(subscription)
}
/// Subscribe to finalized block headers.
///
/// Note: this may not produce _every_ block in the finalized chain;