use std::collections::HashSet;
use fuel_core_storage::Result as StorageResult;
use fuel_core_types::{
blockchain::primitives::DaBlockHeight,
entities::coins::coin::CompressedCoin,
fuel_tx::{
ConsensusParameters,
ContractId,
UtxoId,
},
fuel_types::BlockHeight,
fuel_vm::checked_transaction::CheckedTransaction,
};
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum TransactionFiltered {
Filtered,
NotFiltered,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Filter {
pub excluded_contract_ids: HashSet<ContractId>,
}
impl Filter {
pub fn new(excluded_contract_ids: HashSet<ContractId>) -> Self {
Self {
excluded_contract_ids,
}
}
}
pub struct TransactionSourceExecutableTransactions {
pub transactions: Vec<CheckedTransaction>,
pub filtered: TransactionFiltered,
pub filter: Filter,
}
pub trait TransactionsSource {
fn get_executable_transactions(
&mut self,
gas_limit: u64,
tx_count_limit: u16,
block_transaction_size_limit: u32,
filter: Filter,
) -> TransactionSourceExecutableTransactions;
fn get_new_transactions_notifier(&mut self) -> tokio::sync::Notify;
}
pub trait Storage {
fn get_coin(&self, utxo: &UtxoId) -> StorageResult<Option<CompressedCoin>>;
fn get_da_height_by_l2_height(
&self,
block_height: &BlockHeight,
) -> StorageResult<Option<DaBlockHeight>>;
fn get_consensus_parameters(
&self,
consensus_parameters_version: u32,
) -> StorageResult<ConsensusParameters>;
}