mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 15:51:12 +00:00
BlockId removal: refactor: Finalizer (#12528)
* BlockId removal: refactor: Finalizer It changes the arguments of methods of `Finalizer` trait from: block: `BlockId<Block>` to: hash: `&Block::Hash` This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292) * minor corrections * failing test corrected * minor rework
This commit is contained in:
committed by
GitHub
parent
7aadc2aa3c
commit
749bcd1949
@@ -198,6 +198,7 @@ async fn should_return_finalized_hash() {
|
||||
|
||||
// import new block
|
||||
let block = client.new_block(Default::default()).unwrap().build().unwrap().block;
|
||||
let block_hash = block.hash();
|
||||
client.import(BlockOrigin::Own, block).await.unwrap();
|
||||
|
||||
// no finalization yet
|
||||
@@ -205,9 +206,9 @@ async fn should_return_finalized_hash() {
|
||||
assert_eq!(res, client.genesis_hash());
|
||||
|
||||
// finalize
|
||||
client.finalize_block(BlockId::number(1), None).unwrap();
|
||||
client.finalize_block(&block_hash, None).unwrap();
|
||||
let res: H256 = api.call("chain_getFinalizedHead", EmptyParams::new()).await.unwrap();
|
||||
assert_eq!(res, client.block_hash(1).unwrap().unwrap());
|
||||
assert_eq!(res, block_hash);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -232,8 +233,9 @@ async fn test_head_subscription(method: &str) {
|
||||
let api = new_full(client.clone(), test_executor()).into_rpc();
|
||||
let sub = api.subscribe(method, EmptyParams::new()).await.unwrap();
|
||||
let block = client.new_block(Default::default()).unwrap().build().unwrap().block;
|
||||
let block_hash = block.hash();
|
||||
client.import(BlockOrigin::Own, block).await.unwrap();
|
||||
client.finalize_block(BlockId::number(1), None).unwrap();
|
||||
client.finalize_block(&block_hash, None).unwrap();
|
||||
sub
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user