mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-09 01:17:22 +00:00
chainHead: Support multiple hashes for chainHead_unpin method (#2295)
This PR adds support for multiple hashes being passed to the `chainHeda_unpin` parameters. The `hash` parameter is renamed to `hash_or_hashes` per https://github.com/paritytech/json-rpc-interface-spec/pull/111. While at it, a new integration test is added to check the unpinning of multiple hashes. The API is checked against a hash or a vector of hashes. cc @paritytech/subxt-team --------- Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
//! API trait of the chain head.
|
||||
use crate::chain_head::event::{FollowEvent, MethodResponse, StorageQuery};
|
||||
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
|
||||
use sp_rpc::list::ListOrValue;
|
||||
|
||||
#[rpc(client, server)]
|
||||
pub trait ChainHeadApi<Hash> {
|
||||
@@ -109,16 +110,22 @@ pub trait ChainHeadApi<Hash> {
|
||||
call_parameters: String,
|
||||
) -> RpcResult<MethodResponse>;
|
||||
|
||||
/// Unpin a block reported by the `follow` method.
|
||||
/// Unpin a block or multiple blocks reported by the `follow` method.
|
||||
///
|
||||
/// Ongoing operations that require the provided block
|
||||
/// will continue normally.
|
||||
///
|
||||
/// When this method returns an error, it is guaranteed that no blocks have been unpinned.
|
||||
///
|
||||
/// # Unstable
|
||||
///
|
||||
/// This method is unstable and subject to change in the future.
|
||||
#[method(name = "chainHead_unstable_unpin", blocking)]
|
||||
fn chain_head_unstable_unpin(&self, follow_subscription: String, hash: Hash) -> RpcResult<()>;
|
||||
fn chain_head_unstable_unpin(
|
||||
&self,
|
||||
follow_subscription: String,
|
||||
hash_or_hashes: ListOrValue<Hash>,
|
||||
) -> RpcResult<()>;
|
||||
|
||||
/// Resumes a storage fetch started with `chainHead_storage` after it has generated an
|
||||
/// `operationWaitingForContinue` event.
|
||||
|
||||
Reference in New Issue
Block a user