use fuel_core_types::{
blockchain::primitives::DaBlockHeight,
entities::message::CompressedMessage,
fuel_tx,
fuel_types::MessageId,
};
pub trait TransactionsSource {
fn next(&self, gas_limit: u64) -> Vec<fuel_tx::Transaction>;
}
pub trait RelayerPort {
fn get_message(
&self,
id: &MessageId,
da_height: &DaBlockHeight,
) -> anyhow::Result<Option<CompressedMessage>>;
}
#[cfg(test)]
impl RelayerPort for crate::database::Database {
fn get_message(
&self,
id: &MessageId,
_da_height: &DaBlockHeight,
) -> anyhow::Result<Option<CompressedMessage>> {
use fuel_core_storage::{
tables::Messages,
StorageAsRef,
};
use std::borrow::Cow;
Ok(self.storage::<Messages>().get(id)?.map(Cow::into_owned))
}
}