Skip to content

Commit

Permalink
feat(consensus): TxEnvelope::signature (#1634)
Browse files Browse the repository at this point in the history
* feat(consensus): `TxEnvelope::signature`

* const
  • Loading branch information
rkrasiuk authored Nov 11, 2024
1 parent b08798c commit e747b1e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion crates/consensus/src/transaction/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use alloy_eips::{
eip2718::{Decodable2718, Eip2718Error, Eip2718Result, Encodable2718},
eip2930::AccessList,
};
use alloy_primitives::{Bytes, TxKind, B256};
use alloy_primitives::{Bytes, PrimitiveSignature as Signature, TxKind, B256};
use alloy_rlp::{Decodable, Encodable};
use core::fmt;

Expand Down Expand Up @@ -272,6 +272,17 @@ impl TxEnvelope {
}
}

/// Return the reference to signature.
pub const fn signature(&self) -> &Signature {
match self {
Self::Legacy(tx) => tx.signature(),
Self::Eip2930(tx) => tx.signature(),
Self::Eip1559(tx) => tx.signature(),
Self::Eip4844(tx) => tx.signature(),
Self::Eip7702(tx) => tx.signature(),
}
}

/// Return the hash of the inner Signed.
#[doc(alias = "transaction_hash")]
pub const fn tx_hash(&self) -> &B256 {
Expand Down

0 comments on commit e747b1e

Please sign in to comment.