mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-09 21:08:01 +00:00
Transaction eras (#758)
* Initial groundwork * A mess. * Integrate * Fix tests * Unit tests * Tests for unchecked_extrisnic * fix tab * Improve binary format. * fix tests * Rename extrinsic-pool -> transaction-pool Closes #770 * Implement unimplemented. * typo
This commit is contained in:
@@ -21,7 +21,7 @@ use futures::sync::mpsc;
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use primitives::AuthorityId;
|
||||
use runtime_primitives::{bft::Justification, generic::{BlockId, SignedBlock, Block as RuntimeBlock}};
|
||||
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, Zero, One, As, NumberFor};
|
||||
use runtime_primitives::traits::{Block as BlockT, Header as HeaderT, Zero, One, As, NumberFor, GetHeight, BlockNumberToHash};
|
||||
use runtime_primitives::BuildStorage;
|
||||
use primitives::{Blake2Hasher, RlpCodec, H256};
|
||||
use primitives::storage::{StorageKey, StorageData};
|
||||
@@ -568,6 +568,29 @@ impl<B, E, Block> Client<B, E, Block> where
|
||||
}
|
||||
}
|
||||
|
||||
impl<B, E, Block> GetHeight for Client<B, E, Block> where
|
||||
B: backend::Backend<Block, Blake2Hasher, RlpCodec>,
|
||||
E: CallExecutor<Block, Blake2Hasher, RlpCodec> + Clone,
|
||||
Block: BlockT,
|
||||
{
|
||||
type BlockNumber = <Block::Header as HeaderT>::Number;
|
||||
fn get_height(&self) -> Self::BlockNumber {
|
||||
self.backend.blockchain().info().map(|i| i.best_number).unwrap_or_else(|_| Zero::zero())
|
||||
}
|
||||
}
|
||||
|
||||
impl<B, E, Block> BlockNumberToHash for Client<B, E, Block> where
|
||||
B: backend::Backend<Block, Blake2Hasher, RlpCodec>,
|
||||
E: CallExecutor<Block, Blake2Hasher, RlpCodec> + Clone,
|
||||
Block: BlockT,
|
||||
{
|
||||
type BlockNumber = <Block::Header as HeaderT>::Number;
|
||||
type Hash = Block::Hash;
|
||||
fn block_number_to_hash(&self, n: Self::BlockNumber) -> Option<Self::Hash> {
|
||||
self.block_hash(n).unwrap_or(None)
|
||||
}
|
||||
}
|
||||
|
||||
impl<B, E, Block> bft::BlockImport<Block> for Client<B, E, Block>
|
||||
where
|
||||
B: backend::Backend<Block, Blake2Hasher, RlpCodec>,
|
||||
|
||||
Reference in New Issue
Block a user