diff --git a/crates/primitives/src/transaction/mod.rs b/crates/primitives/src/transaction/mod.rs index 055402c302..796baf2986 100644 --- a/crates/primitives/src/transaction/mod.rs +++ b/crates/primitives/src/transaction/mod.rs @@ -780,6 +780,8 @@ impl Decodable for TransactionKind { } /// Signed transaction without its Hash. Used type for inserting into the DB. +/// +/// This can by converted to [`TransactionSigned`] by calling [`TransactionSignedNoHash::hash`]. #[derive_arbitrary(compact)] #[derive(Debug, Clone, PartialEq, Eq, Hash, AsRef, Deref, Default, Serialize, Deserialize)] pub struct TransactionSignedNoHash { @@ -800,6 +802,14 @@ impl TransactionSignedNoHash { keccak256(&buf) } + /// Recover signer from signature and hash. + /// + /// Returns `None` if the transaction's signature is invalid, see also [Self::recover_signer]. + pub fn recover_signer(&self) -> Option
{ + let signature_hash = self.signature_hash(); + self.signature.recover_signer(signature_hash) + } + /// Converts into a transaction type with its hash: [`TransactionSigned`]. pub fn with_hash(self) -> TransactionSigned { self.into() @@ -938,7 +948,7 @@ impl TransactionSigned { self.signature.recover_signer(signature_hash) } - /// Devour Self, recover signer and return [`TransactionSignedEcRecovered`] + /// Consumes the type, recover signer and return [`TransactionSignedEcRecovered`] /// /// Returns `None` if the transaction's signature is invalid, see also [Self::recover_signer]. pub fn into_ecrecovered(self) -> Option