mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-19 03:04:27 -05:00
feat(txpool): add PoolTransaction::consensus_ref (#22182)
Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
committed by
GitHub
parent
2be3788481
commit
d71a0c0c7b
5
.changelog/fast-seals-play.md
Normal file
5
.changelog/fast-seals-play.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
reth-transaction-pool: minor
|
||||
---
|
||||
|
||||
Added `consensus_ref` method to `PoolTransaction` trait for borrowing consensus transactions without cloning.
|
||||
@@ -704,6 +704,10 @@ impl PoolTransaction for MockTransaction {
|
||||
|
||||
type Pooled = PooledTransactionVariant;
|
||||
|
||||
fn consensus_ref(&self) -> Recovered<&Self::Consensus> {
|
||||
unimplemented!("mock transaction does not wrap a consensus transaction")
|
||||
}
|
||||
|
||||
fn into_consensus(self) -> Recovered<Self::Consensus> {
|
||||
self.into()
|
||||
}
|
||||
|
||||
@@ -1257,6 +1257,9 @@ pub trait PoolTransaction:
|
||||
self.clone().into_consensus()
|
||||
}
|
||||
|
||||
/// Returns a reference to the consensus transaction with the recovered sender.
|
||||
fn consensus_ref(&self) -> Recovered<&Self::Consensus>;
|
||||
|
||||
/// Define a method to convert from the `Self` type to `Consensus`
|
||||
fn into_consensus(self) -> Recovered<Self::Consensus>;
|
||||
|
||||
@@ -1447,6 +1450,10 @@ impl PoolTransaction for EthPooledTransaction {
|
||||
self.transaction().clone()
|
||||
}
|
||||
|
||||
fn consensus_ref(&self) -> Recovered<&Self::Consensus> {
|
||||
Recovered::new_unchecked(&*self.transaction, self.transaction.signer())
|
||||
}
|
||||
|
||||
fn into_consensus(self) -> Recovered<Self::Consensus> {
|
||||
self.transaction
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user