mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 05:38:00 +00:00
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:
@@ -31,6 +31,7 @@ use crate::blockchain::Info;
|
||||
use crate::notifications::StorageEventStream;
|
||||
use sp_utils::mpsc::TracingUnboundedReceiver;
|
||||
use sp_blockchain;
|
||||
use sc_transaction_pool_api::ChainEvent;
|
||||
|
||||
/// Type that implements `futures::Stream` of block import events.
|
||||
pub type ImportNotifications<Block> = TracingUnboundedReceiver<BlockImportNotification<Block>>;
|
||||
@@ -278,7 +279,7 @@ pub struct FinalityNotification<Block: BlockT> {
|
||||
pub header: Block::Header,
|
||||
}
|
||||
|
||||
impl<B: BlockT> TryFrom<BlockImportNotification<B>> for sp_transaction_pool::ChainEvent<B> {
|
||||
impl<B: BlockT> TryFrom<BlockImportNotification<B>> for ChainEvent<B> {
|
||||
type Error = ();
|
||||
|
||||
fn try_from(n: BlockImportNotification<B>) -> Result<Self, ()> {
|
||||
@@ -293,7 +294,7 @@ impl<B: BlockT> TryFrom<BlockImportNotification<B>> for sp_transaction_pool::Cha
|
||||
}
|
||||
}
|
||||
|
||||
impl<B: BlockT> From<FinalityNotification<B>> for sp_transaction_pool::ChainEvent<B> {
|
||||
impl<B: BlockT> From<FinalityNotification<B>> for ChainEvent<B> {
|
||||
fn from(n: FinalityNotification<B>) -> Self {
|
||||
Self::Finalized {
|
||||
hash: n.hash,
|
||||
|
||||
@@ -37,6 +37,7 @@ use sp_state_machine::{ExecutionManager, DefaultHandler};
|
||||
pub use sp_state_machine::ExecutionStrategy;
|
||||
use sp_externalities::Extensions;
|
||||
use parking_lot::RwLock;
|
||||
use sc_transaction_pool_api::OffchainSubmitTransaction;
|
||||
|
||||
/// Execution strategies settings.
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -104,7 +105,7 @@ pub struct ExecutionExtensions<Block: traits::Block> {
|
||||
// extension to be a `Weak` reference.
|
||||
// That's also the reason why it's being registered lazily instead of
|
||||
// during initialization.
|
||||
transaction_pool: RwLock<Option<Weak<dyn sp_transaction_pool::OffchainSubmitTransaction<Block>>>>,
|
||||
transaction_pool: RwLock<Option<Weak<dyn OffchainSubmitTransaction<Block>>>>,
|
||||
extensions_factory: RwLock<Box<dyn ExtensionsFactory>>,
|
||||
}
|
||||
|
||||
@@ -150,7 +151,7 @@ impl<Block: traits::Block> ExecutionExtensions<Block> {
|
||||
|
||||
/// Register transaction pool extension.
|
||||
pub fn register_transaction_pool<T>(&self, pool: &Arc<T>)
|
||||
where T: sp_transaction_pool::OffchainSubmitTransaction<Block> + 'static
|
||||
where T: OffchainSubmitTransaction<Block> + 'static
|
||||
{
|
||||
*self.transaction_pool.write() = Some(Arc::downgrade(&pool) as _);
|
||||
}
|
||||
@@ -235,7 +236,7 @@ impl<Block: traits::Block> ExecutionExtensions<Block> {
|
||||
/// A wrapper type to pass `BlockId` to the actual transaction pool.
|
||||
struct TransactionPoolAdapter<Block: traits::Block> {
|
||||
at: BlockId<Block>,
|
||||
pool: Arc<dyn sp_transaction_pool::OffchainSubmitTransaction<Block>>,
|
||||
pool: Arc<dyn OffchainSubmitTransaction<Block>>,
|
||||
}
|
||||
|
||||
impl<Block: traits::Block> offchain::TransactionPool for TransactionPoolAdapter<Block> {
|
||||
|
||||
Reference in New Issue
Block a user