fuel_block_producer/
adapters.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use crate::{
    adapters::transaction_selector::select_transactions,
    ports::TxPool,
};
use fuel_core_interfaces::{
    model::{
        ArcPoolTx,
        BlockHeight,
    },
    txpool::Sender,
};

pub mod transaction_selector;

pub struct TxPoolAdapter {
    pub sender: Sender,
}

#[async_trait::async_trait]
impl TxPool for TxPoolAdapter {
    async fn get_includable_txs(
        &self,
        _block_height: BlockHeight,
        max_gas: u64,
    ) -> anyhow::Result<Vec<ArcPoolTx>> {
        let includable_txs =
            select_transactions(self.sender.includable().await?, max_gas);

        Ok(includable_txs)
    }
}