mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 10:11:03 +00:00
BlockId removal: refactor: BlockBackend::block|block_status (#13014)
* BlockId removal: refactor: BlockBackend::block|block_status It changes the arguments of: - `BlockBackend::block` - `BlockBackend::block_status` method from: `BlockId<Block>` to: `Block::Hash` This PR is part of BlockId::Number refactoring analysis (paritytech/substrate#11292) * non-obvious reworks * doc fix * Apply suggestions from code review Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: parity-processbot <>
This commit is contained in:
committed by
GitHub
parent
66cfd01f17
commit
9c69fc1b32
@@ -1137,7 +1137,7 @@ fn get_block_by_bad_block_hash_returns_none() {
|
||||
let client = substrate_test_runtime_client::new();
|
||||
|
||||
let hash = H256::from_low_u64_be(5);
|
||||
assert!(client.block(&BlockId::Hash(hash)).unwrap().is_none());
|
||||
assert!(client.block(hash).unwrap().is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1497,10 +1497,7 @@ fn returns_status_for_pruned_blocks() {
|
||||
block_on(client.check_block(check_block_a1.clone())).unwrap(),
|
||||
ImportResult::imported(false),
|
||||
);
|
||||
assert_eq!(
|
||||
client.block_status(&BlockId::hash(check_block_a1.hash)).unwrap(),
|
||||
BlockStatus::Unknown,
|
||||
);
|
||||
assert_eq!(client.block_status(check_block_a1.hash).unwrap(), BlockStatus::Unknown);
|
||||
|
||||
block_on(client.import_as_final(BlockOrigin::Own, a1.clone())).unwrap();
|
||||
|
||||
@@ -1508,10 +1505,7 @@ fn returns_status_for_pruned_blocks() {
|
||||
block_on(client.check_block(check_block_a1.clone())).unwrap(),
|
||||
ImportResult::AlreadyInChain,
|
||||
);
|
||||
assert_eq!(
|
||||
client.block_status(&BlockId::hash(check_block_a1.hash)).unwrap(),
|
||||
BlockStatus::InChainWithState,
|
||||
);
|
||||
assert_eq!(client.block_status(check_block_a1.hash).unwrap(), BlockStatus::InChainWithState);
|
||||
|
||||
let a2 = client
|
||||
.new_block_at(&BlockId::Hash(a1.hash()), Default::default(), false)
|
||||
@@ -1534,18 +1528,12 @@ fn returns_status_for_pruned_blocks() {
|
||||
block_on(client.check_block(check_block_a1.clone())).unwrap(),
|
||||
ImportResult::AlreadyInChain,
|
||||
);
|
||||
assert_eq!(
|
||||
client.block_status(&BlockId::hash(check_block_a1.hash)).unwrap(),
|
||||
BlockStatus::InChainPruned,
|
||||
);
|
||||
assert_eq!(client.block_status(check_block_a1.hash).unwrap(), BlockStatus::InChainPruned);
|
||||
assert_eq!(
|
||||
block_on(client.check_block(check_block_a2.clone())).unwrap(),
|
||||
ImportResult::AlreadyInChain,
|
||||
);
|
||||
assert_eq!(
|
||||
client.block_status(&BlockId::hash(check_block_a2.hash)).unwrap(),
|
||||
BlockStatus::InChainWithState,
|
||||
);
|
||||
assert_eq!(client.block_status(check_block_a2.hash).unwrap(), BlockStatus::InChainWithState);
|
||||
|
||||
let a3 = client
|
||||
.new_block_at(&BlockId::Hash(a2.hash()), Default::default(), false)
|
||||
@@ -1569,26 +1557,17 @@ fn returns_status_for_pruned_blocks() {
|
||||
block_on(client.check_block(check_block_a1.clone())).unwrap(),
|
||||
ImportResult::AlreadyInChain,
|
||||
);
|
||||
assert_eq!(
|
||||
client.block_status(&BlockId::hash(check_block_a1.hash)).unwrap(),
|
||||
BlockStatus::InChainPruned,
|
||||
);
|
||||
assert_eq!(client.block_status(check_block_a1.hash).unwrap(), BlockStatus::InChainPruned);
|
||||
assert_eq!(
|
||||
block_on(client.check_block(check_block_a2.clone())).unwrap(),
|
||||
ImportResult::AlreadyInChain,
|
||||
);
|
||||
assert_eq!(
|
||||
client.block_status(&BlockId::hash(check_block_a2.hash)).unwrap(),
|
||||
BlockStatus::InChainPruned,
|
||||
);
|
||||
assert_eq!(client.block_status(check_block_a2.hash).unwrap(), BlockStatus::InChainPruned);
|
||||
assert_eq!(
|
||||
block_on(client.check_block(check_block_a3.clone())).unwrap(),
|
||||
ImportResult::AlreadyInChain,
|
||||
);
|
||||
assert_eq!(
|
||||
client.block_status(&BlockId::hash(check_block_a3.hash)).unwrap(),
|
||||
BlockStatus::InChainWithState,
|
||||
);
|
||||
assert_eq!(client.block_status(check_block_a3.hash).unwrap(), BlockStatus::InChainWithState);
|
||||
|
||||
let mut check_block_b1 = BlockCheckParams {
|
||||
hash: b1.hash(),
|
||||
|
||||
Reference in New Issue
Block a user