Skip to content

Commit

Permalink
chore: add encodable to pooled recovered (#12866)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Nov 26, 2024
1 parent aa0a114 commit 1b4048e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions crates/primitives/src/transaction/pooled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down
2 changes: 1 addition & 1 deletion crates/transaction-pool/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down

0 comments on commit 1b4048e

Please sign in to comment.