sc-transcation-pool refactor (#9228)

* Use TransactionPool trait

* sc-transaction-pool-primitives

* sc-transaction-pool-api

* TP

* bye sc_transaction_graph

* fix line widths

* fix import errors

* fix import errors

* fix import errors 🤦🏾‍♂️

* fix import errors 🤦🏾‍♂️🤦🏾‍♂️🤦🏾‍♂️

* remove sp-keyring
This commit is contained in:
Seun Lanlege
2021-07-08 14:33:34 +01:00
committed by GitHub
parent 721a3b9e9c
commit 2ae9d36758
65 changed files with 384 additions and 388 deletions
@@ -39,10 +39,10 @@ use futures::future::ready;
/// Error type used by [`TestApi`].
#[derive(Debug, derive_more::From, derive_more::Display)]
pub struct Error(sp_transaction_pool::error::Error);
pub struct Error(sc_transaction_pool_api::error::Error);
impl sp_transaction_pool::error::IntoPoolError for Error {
fn into_pool_error(self) -> Result<sp_transaction_pool::error::Error, Self> {
impl sc_transaction_pool_api::error::IntoPoolError for Error {
fn into_pool_error(self) -> Result<sc_transaction_pool_api::error::Error, Self> {
Ok(self.0)
}
}
@@ -226,7 +226,7 @@ impl TestApi {
}
}
impl sc_transaction_graph::ChainApi for TestApi {
impl sc_transaction_pool::test_helpers::ChainApi for TestApi {
type Block = Block;
type Error = Error;
type ValidationFuture = futures::future::Ready<Result<TransactionValidity, Error>>;
@@ -236,7 +236,7 @@ impl sc_transaction_graph::ChainApi for TestApi {
&self,
at: &BlockId<Self::Block>,
_source: TransactionSource,
uxt: sc_transaction_graph::ExtrinsicFor<Self>,
uxt: sc_transaction_pool::test_helpers::ExtrinsicFor<Self>,
) -> Self::ValidationFuture {
self.validation_requests.write().push(uxt.clone());
@@ -300,7 +300,7 @@ impl sc_transaction_graph::ChainApi for TestApi {
fn block_id_to_number(
&self,
at: &BlockId<Self::Block>,
) -> Result<Option<sc_transaction_graph::NumberFor<Self>>, Error> {
) -> Result<Option<sc_transaction_pool::test_helpers::NumberFor<Self>>, Error> {
Ok(match at {
generic::BlockId::Hash(x) => self.chain
.read()
@@ -314,7 +314,7 @@ impl sc_transaction_graph::ChainApi for TestApi {
fn block_id_to_hash(
&self,
at: &BlockId<Self::Block>,
) -> Result<Option<sc_transaction_graph::BlockHash<Self>>, Error> {
) -> Result<Option<sc_transaction_pool::test_helpers::BlockHash<Self>>, Error> {
Ok(match at {
generic::BlockId::Hash(x) => Some(x.clone()),
generic::BlockId::Number(num) => self.chain
@@ -327,7 +327,7 @@ impl sc_transaction_graph::ChainApi for TestApi {
fn hash_and_length(
&self,
ex: &sc_transaction_graph::ExtrinsicFor<Self>,
ex: &sc_transaction_pool::test_helpers::ExtrinsicFor<Self>,
) -> (Hash, usize) {
Self::hash_and_length_inner(ex)
}