reth_node_core::primitives

Trait SignedTransaction

pub trait SignedTransaction:
    Send
    + Sync
    + Unpin
    + Clone
    + Debug
    + PartialEq
    + Eq
    + Hash
    + Encodable
    + Decodable
    + Encodable2718
    + Decodable2718
    + Transaction
    + MaybeSerde
    + InMemorySize {
    // Required methods
    fn tx_hash(&self) -> &FixedBytes<32>;
    fn signature(&self) -> &PrimitiveSignature;
    fn recover_signer(&self) -> Option<Address>;
    fn recover_signer_unchecked_with_buf(
        &self,
        buf: &mut Vec<u8>,
    ) -> Option<Address>;

    // Provided methods
    fn is_broadcastable_in_full(&self) -> bool { ... }
    fn recover_signer_unchecked(&self) -> Option<Address> { ... }
    fn recalculate_hash(&self) -> FixedBytes<32> { ... }
}
Expand description

A signed transaction.

Required Methods§

fn tx_hash(&self) -> &FixedBytes<32>

Returns reference to transaction hash.

fn signature(&self) -> &PrimitiveSignature

Returns reference to signature.

fn recover_signer(&self) -> Option<Address>

Recover signer from signature and hash.

Returns None if the transaction’s signature is invalid following EIP-2, see also reth_primitives::transaction::recover_signer.

Note:

This can fail for some early ethereum mainnet transactions pre EIP-2, use Self::recover_signer_unchecked if you want to recover the signer without ensuring that the signature has a low s value.

fn recover_signer_unchecked_with_buf( &self, buf: &mut Vec<u8>, ) -> Option<Address>

Same as Self::recover_signer_unchecked but receives a buffer to operate on. This is used during batch recovery to avoid allocating a new buffer for each transaction.

Provided Methods§

fn is_broadcastable_in_full(&self) -> bool

Returns whether this transaction type can be broadcasted as full transaction over the network.

Some transactions are not broadcastable as objects and only allowed to be broadcasted as hashes, e.g. because they missing context (e.g. blob sidecar).

fn recover_signer_unchecked(&self) -> Option<Address>

Recover signer from signature and hash without ensuring that the signature has a low s value.

Returns None if the transaction’s signature is invalid, see also reth_primitives::transaction::recover_signer_unchecked.

fn recalculate_hash(&self) -> FixedBytes<32>

Calculate transaction hash, eip2728 transaction does not contain rlp header and start with tx type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl SignedTransaction for OpPooledTransaction

Available on crate feature op only.
§

fn tx_hash(&self) -> &FixedBytes<32>

§

fn signature(&self) -> &PrimitiveSignature

§

fn recover_signer(&self) -> Option<Address>

§

fn recover_signer_unchecked_with_buf( &self, buf: &mut Vec<u8>, ) -> Option<Address>

§

impl SignedTransaction for PooledTransaction

§

fn tx_hash(&self) -> &FixedBytes<32>

§

fn signature(&self) -> &PrimitiveSignature

§

fn recover_signer(&self) -> Option<Address>

§

fn recover_signer_unchecked_with_buf( &self, buf: &mut Vec<u8>, ) -> Option<Address>

§

impl SignedTransaction for TransactionSigned

§

fn tx_hash(&self) -> &FixedBytes<32>

§

fn signature(&self) -> &PrimitiveSignature

§

fn recover_signer(&self) -> Option<Address>

§

fn recover_signer_unchecked_with_buf( &self, buf: &mut Vec<u8>, ) -> Option<Address>

§

impl<'a, T> SignedTransaction for &'a T
where T: 'a + SignedTransaction + ?Sized, &'a T: Send + Sync + Unpin + Clone + Debug + PartialEq + Eq + Hash + Encodable + Decodable + Encodable2718 + Decodable2718 + Transaction + MaybeSerde + InMemorySize,

§

fn tx_hash(&self) -> &FixedBytes<32>

§

fn signature(&self) -> &PrimitiveSignature

§

fn is_broadcastable_in_full(&self) -> bool

§

fn recover_signer(&self) -> Option<Address>

§

fn recover_signer_unchecked(&self) -> Option<Address>

§

fn recover_signer_unchecked_with_buf( &self, buf: &mut Vec<u8>, ) -> Option<Address>

§

fn recalculate_hash(&self) -> FixedBytes<32>

§

impl<T> SignedTransaction for Arc<T>
where T: SignedTransaction + ?Sized, Arc<T>: Send + Sync + Unpin + Clone + Debug + PartialEq + Eq + Hash + Encodable + Decodable + Encodable2718 + Decodable2718 + Transaction + MaybeSerde + InMemorySize,

§

fn tx_hash(&self) -> &FixedBytes<32>

§

fn signature(&self) -> &PrimitiveSignature

§

fn is_broadcastable_in_full(&self) -> bool

§

fn recover_signer(&self) -> Option<Address>

§

fn recover_signer_unchecked(&self) -> Option<Address>

§

fn recover_signer_unchecked_with_buf( &self, buf: &mut Vec<u8>, ) -> Option<Address>

§

fn recalculate_hash(&self) -> FixedBytes<32>

Implementors§