sc_transaction_pool/
lib.rs

1// This file is part of Substrate.
2
3// Copyright (C) Parity Technologies (UK) Ltd.
4// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
5
6// This program is free software: you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License
17// along with this program. If not, see <https://www.gnu.org/licenses/>.
18
19//! Substrate transaction pool implementation.
20
21#![recursion_limit = "256"]
22#![warn(missing_docs)]
23#![warn(unused_extern_crates)]
24
25mod builder;
26mod common;
27mod fork_aware_txpool;
28mod graph;
29mod single_state_txpool;
30mod transaction_pool_wrapper;
31
32use common::{api, enactment_state};
33use std::{future::Future, pin::Pin, sync::Arc};
34
35pub use api::FullChainApi;
36pub use builder::{Builder, TransactionPoolHandle, TransactionPoolOptions, TransactionPoolType};
37pub use common::notification_future;
38pub use fork_aware_txpool::{ForkAwareTxPool, ForkAwareTxPoolTask};
39pub use graph::{base_pool::Limit as PoolLimit, ChainApi, Options, Pool};
40use single_state_txpool::prune_known_txs_for_block;
41pub use single_state_txpool::{BasicPool, RevalidationType};
42pub use transaction_pool_wrapper::TransactionPoolWrapper;
43
44type BoxedReadyIterator<Hash, Data> = Box<
45	dyn sc_transaction_pool_api::ReadyTransactions<
46			Item = Arc<graph::base_pool::Transaction<Hash, Data>>,
47		> + Send,
48>;
49
50type ReadyIteratorFor<PoolApi> =
51	BoxedReadyIterator<graph::ExtrinsicHash<PoolApi>, graph::ExtrinsicFor<PoolApi>>;
52
53type PolledIterator<PoolApi> = Pin<Box<dyn Future<Output = ReadyIteratorFor<PoolApi>> + Send>>;
54
55/// Log target for transaction pool.
56///
57/// It can be used by other components for logging functionality strictly related to txpool (e.g.
58/// importing transaction).
59pub const LOG_TARGET: &str = "txpool";