mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-21 22:35:41 +00:00
Fix tests.
This commit is contained in:
@@ -21,7 +21,7 @@ use codec::{Joiner, Slicable};
|
|||||||
use state_machine::{self, CodeExecutor};
|
use state_machine::{self, CodeExecutor};
|
||||||
use primitives::{Header, Block};
|
use primitives::{Header, Block};
|
||||||
use primitives::block::Transaction;
|
use primitives::block::Transaction;
|
||||||
use {backend, error, BlockId, BlockStatus, Client};
|
use {backend, error, BlockId, Client};
|
||||||
use triehash::ordered_trie_root;
|
use triehash::ordered_trie_root;
|
||||||
|
|
||||||
/// Utility for building new (valid) blocks from a stream of transactions.
|
/// Utility for building new (valid) blocks from a stream of transactions.
|
||||||
@@ -44,11 +44,7 @@ impl<B, E> BlockBuilder<B, E> where
|
|||||||
{
|
{
|
||||||
/// Create a new instance of builder from the given client, building on the latest block.
|
/// Create a new instance of builder from the given client, building on the latest block.
|
||||||
pub fn new(client: &Client<B, E>) -> error::Result<Self> {
|
pub fn new(client: &Client<B, E>) -> error::Result<Self> {
|
||||||
let best = (client.info().map(|i| i.chain.best_number)?..1)
|
client.info().and_then(|i| Self::at_block(&BlockId::Hash(i.chain.best_hash), client))
|
||||||
.find(|&n| if let Ok(BlockStatus::InChain) = client.block_status(&BlockId::Number(n))
|
|
||||||
{ true } else { false })
|
|
||||||
.unwrap_or(0);
|
|
||||||
Self::at_block(&BlockId::Number(best), client)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create a new instance of builder from the given client using a particular block's ID to
|
/// Create a new instance of builder from the given client using a particular block's ID to
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ fn should_return_storage() {
|
|||||||
|
|
||||||
assert_matches!(
|
assert_matches!(
|
||||||
StateApi::storage(&client, StorageKey(vec![10]), genesis_hash),
|
StateApi::storage(&client, StorageKey(vec![10]), genesis_hash),
|
||||||
Ok(ref x) if x.0.is_empty()
|
Err(Error(ErrorKind::Client(client::error::ErrorKind::NoValueForKey(ref k)), _)) if *k == vec![10]
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user