mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-08 03:01:12 -04:00
feat(p2p): integrate txpool in p2p (#208)
This commit is contained in:
@@ -42,8 +42,8 @@ pub use log::Log;
|
||||
pub use receipt::Receipt;
|
||||
pub use storage::StorageEntry;
|
||||
pub use transaction::{
|
||||
AccessList, AccessListItem, FromRecoveredTransaction, Signature, Transaction, TransactionKind,
|
||||
TransactionSigned, TransactionSignedEcRecovered, TxType,
|
||||
AccessList, AccessListItem, FromRecoveredTransaction, IntoRecoveredTransaction, Signature,
|
||||
Transaction, TransactionKind, TransactionSigned, TransactionSignedEcRecovered, TxType,
|
||||
};
|
||||
|
||||
/// A block hash.
|
||||
|
||||
@@ -571,6 +571,8 @@ impl TransactionSigned {
|
||||
}
|
||||
|
||||
/// Recover signer from signature and hash.
|
||||
///
|
||||
/// Returns `None` if the transaction's signature is invalid.
|
||||
pub fn recover_signer(&self) -> Option<Address> {
|
||||
let signature_hash = self.signature_hash();
|
||||
self.signature.recover_signer(signature_hash)
|
||||
@@ -724,6 +726,22 @@ impl FromRecoveredTransaction for TransactionSignedEcRecovered {
|
||||
}
|
||||
}
|
||||
|
||||
/// The inverse of [`FromRecoveredTransaction`] that ensure the transaction can be sent over the
|
||||
/// network
|
||||
pub trait IntoRecoveredTransaction {
|
||||
/// Converts to this type into a [`TransactionSignedEcRecovered`].
|
||||
///
|
||||
/// Note: this takes `&self` since indented usage is via `Arc<Self>`.
|
||||
fn to_recovered_transaction(&self) -> TransactionSignedEcRecovered;
|
||||
}
|
||||
|
||||
impl IntoRecoveredTransaction for TransactionSignedEcRecovered {
|
||||
#[inline]
|
||||
fn to_recovered_transaction(&self) -> TransactionSignedEcRecovered {
|
||||
self.clone()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{
|
||||
|
||||
Reference in New Issue
Block a user