feat: implement transaction fetcher, w/o redundant tx hash request (#5058)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Sean Matt
2023-10-26 07:49:28 -04:00
committed by GitHub
parent f782a33310
commit c1a6e42d19
3 changed files with 219 additions and 31 deletions

View File

@ -39,6 +39,13 @@ pub struct PooledTransactions(
pub Vec<PooledTransactionsElement>,
);
impl PooledTransactions {
/// Returns an iterator over the transaction hashes in this response.
pub fn hashes(&self) -> impl Iterator<Item = &B256> + '_ {
self.0.iter().map(|tx| tx.hash())
}
}
impl From<Vec<TransactionSigned>> for PooledTransactions {
fn from(txs: Vec<TransactionSigned>) -> Self {
PooledTransactions(txs.into_iter().map(Into::into).collect())