// This file is part of Substrate.
// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
use std::{
collections::HashMap,
sync::Arc,
};
use crate::{base_pool as base, watcher::Watcher};
use futures::Future;
use sp_runtime::{
generic::BlockId,
traits::{self, SaturatedConversion, Block as BlockT},
transaction_validity::{
TransactionValidity, TransactionTag as Tag, TransactionValidityError, TransactionSource,
},
};
use sp_transaction_pool::error;
use wasm_timer::Instant;
use futures::channel::mpsc::Receiver;
use crate::validated_pool::ValidatedPool;
pub use crate::validated_pool::ValidatedTransaction;
/// Modification notification event stream type;
pub type EventStream = Receiver;
/// Block hash type for a pool.
pub type BlockHash = <::Block as traits::Block>::Hash;
/// Extrinsic hash type for a pool.
pub type ExtrinsicHash = <::Block as traits::Block>::Hash;
/// Extrinsic type for a pool.
pub type ExtrinsicFor = <::Block as traits::Block>::Extrinsic;
/// Block number type for the ChainApi
pub type NumberFor = traits::NumberFor<::Block>;
/// A type of transaction stored in the pool
pub type TransactionFor = Arc, ExtrinsicFor>>;
/// A type of validated transaction stored in the pool.
pub type ValidatedTransactionFor = ValidatedTransaction<
ExtrinsicHash,
ExtrinsicFor,
::Error,
>;
/// Concrete extrinsic validation and query logic.
pub trait ChainApi: Send + Sync {
/// Block type.
type Block: BlockT;
/// Error type.
type Error: From + error::IntoPoolError;
/// Validate transaction future.
type ValidationFuture: Future