use std::collections::HashSet;
use fuel_core_types::fuel_tx::ContractId;
use crate::storage::{
RemovedTransactions,
StorageData,
};
pub mod ratio_tip_gas;
pub struct Constraints {
pub minimal_gas_price: u64,
pub max_gas: u64,
pub maximum_txs: u16,
pub maximum_block_size: u32,
pub excluded_contracts: HashSet<ContractId>,
}
pub trait SelectionAlgorithm {
type Storage;
type StorageIndex;
fn gather_best_txs(
&mut self,
constraints: Constraints,
storage: &mut Self::Storage,
) -> RemovedTransactions;
fn new_executable_transaction(
&mut self,
storage_id: Self::StorageIndex,
store_entry: &StorageData,
);
fn number_of_executable_transactions(&self) -> usize;
fn get_less_worth_txs(&self) -> impl Iterator<Item = &Self::StorageIndex>;
fn on_removed_transaction(&mut self, storage_entry: &StorageData);
}