chore: add encodable to pooled recovered (#12866)

This commit is contained in:
Matthias Seitz
2024-11-26 11:44:57 +01:00
committed by GitHub
parent aa0a114b0d
commit 1b4048e47d
2 changed files with 19 additions and 1 deletions

View File

@ -739,6 +739,24 @@ impl TryFrom<TransactionSignedEcRecovered> for PooledTransactionsElementEcRecove
}
}
impl Encodable2718 for PooledTransactionsElementEcRecovered {
fn type_flag(&self) -> Option<u8> {
self.transaction.type_flag()
}
fn encode_2718_len(&self) -> usize {
self.transaction.encode_2718_len()
}
fn encode_2718(&self, out: &mut dyn alloy_rlp::BufMut) {
self.transaction.encode_2718(out)
}
fn trie_hash(&self) -> B256 {
self.transaction.trie_hash()
}
}
#[cfg(test)]
mod tests {
use super::*;

View File

@ -947,7 +947,7 @@ pub trait PoolTransaction: fmt::Debug + Send + Sync + Clone {
type Consensus: From<Self> + TryInto<Self, Error = Self::TryFromConsensusError>;
/// Associated type representing the recovered pooled variant of the transaction.
type Pooled: Into<Self>;
type Pooled: Encodable2718 + Into<Self>;
/// Define a method to convert from the `Consensus` type to `Self`
fn try_from_consensus(tx: Self::Consensus) -> Result<Self, Self::TryFromConsensusError> {