mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
BlockId removal: refactor: Backend::state_at (#12488)
* Minor naming improved * BlockId removal refactor: Backend::state_at * formatting
This commit is contained in:
committed by
GitHub
parent
dcd56b1ffd
commit
532dd5ecc2
@@ -20,7 +20,7 @@ use futures::executor::block_on;
|
||||
use parity_scale_codec::{Decode, Encode, Joiner};
|
||||
use sc_block_builder::BlockBuilderProvider;
|
||||
use sc_client_api::{
|
||||
in_mem, BlockBackend, BlockchainEvents, FinalityNotifications, StorageProvider,
|
||||
in_mem, BlockBackend, BlockchainEvents, FinalityNotifications, HeaderBackend, StorageProvider,
|
||||
};
|
||||
use sc_client_db::{Backend, BlocksPruning, DatabaseSettings, DatabaseSource, PruningMode};
|
||||
use sc_consensus::{
|
||||
@@ -338,11 +338,15 @@ fn block_builder_works_with_transactions() {
|
||||
let block = builder.build().unwrap().block;
|
||||
block_on(client.import(BlockOrigin::Own, block)).unwrap();
|
||||
|
||||
let hash0 = client
|
||||
.expect_block_hash_from_id(&BlockId::Number(0))
|
||||
.expect("block 0 was just imported. qed");
|
||||
let hash1 = client
|
||||
.expect_block_hash_from_id(&BlockId::Number(1))
|
||||
.expect("block 1 was just imported. qed");
|
||||
|
||||
assert_eq!(client.chain_info().best_number, 1);
|
||||
assert_ne!(
|
||||
client.state_at(&BlockId::Number(1)).unwrap().pairs(),
|
||||
client.state_at(&BlockId::Number(0)).unwrap().pairs()
|
||||
);
|
||||
assert_ne!(client.state_at(&hash1).unwrap().pairs(), client.state_at(&hash0).unwrap().pairs());
|
||||
assert_eq!(
|
||||
client
|
||||
.runtime_api()
|
||||
@@ -392,11 +396,15 @@ fn block_builder_does_not_include_invalid() {
|
||||
let block = builder.build().unwrap().block;
|
||||
block_on(client.import(BlockOrigin::Own, block)).unwrap();
|
||||
|
||||
let hash0 = client
|
||||
.expect_block_hash_from_id(&BlockId::Number(0))
|
||||
.expect("block 0 was just imported. qed");
|
||||
let hash1 = client
|
||||
.expect_block_hash_from_id(&BlockId::Number(1))
|
||||
.expect("block 1 was just imported. qed");
|
||||
|
||||
assert_eq!(client.chain_info().best_number, 1);
|
||||
assert_ne!(
|
||||
client.state_at(&BlockId::Number(1)).unwrap().pairs(),
|
||||
client.state_at(&BlockId::Number(0)).unwrap().pairs()
|
||||
);
|
||||
assert_ne!(client.state_at(&hash1).unwrap().pairs(), client.state_at(&hash0).unwrap().pairs());
|
||||
assert_eq!(client.body(&BlockId::Number(1)).unwrap().unwrap().len(), 1)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user