mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: support blob transactions in manager (#4294)
This commit is contained in:
@ -46,6 +46,17 @@ pub enum PooledTransactionsElement {
|
||||
}
|
||||
|
||||
impl PooledTransactionsElement {
|
||||
/// Tries to convert a [TransactionSigned] into a [PooledTransactionsElement].
|
||||
///
|
||||
/// [BlobTransaction] are disallowed from being propagated, hence this returns an error if the
|
||||
/// `tx` is [Transaction::Eip4844]
|
||||
pub fn try_from_broadcast(tx: TransactionSigned) -> Result<Self, TransactionSigned> {
|
||||
if tx.is_eip4844() {
|
||||
return Err(tx)
|
||||
}
|
||||
Ok(tx.into())
|
||||
}
|
||||
|
||||
/// Heavy operation that return signature hash over rlp encoded transaction.
|
||||
/// It is only for signature signing or signer recovery.
|
||||
pub fn signature_hash(&self) -> H256 {
|
||||
@ -57,6 +68,16 @@ impl PooledTransactionsElement {
|
||||
}
|
||||
}
|
||||
|
||||
/// Reference to transaction hash. Used to identify transaction.
|
||||
pub fn hash(&self) -> &TxHash {
|
||||
match self {
|
||||
PooledTransactionsElement::Legacy { hash, .. } => hash,
|
||||
PooledTransactionsElement::Eip2930 { hash, .. } => hash,
|
||||
PooledTransactionsElement::Eip1559 { hash, .. } => hash,
|
||||
PooledTransactionsElement::BlobTransaction(tx) => &tx.hash,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the signature of the transaction.
|
||||
pub fn signature(&self) -> &Signature {
|
||||
match self {
|
||||
|
||||
Reference in New Issue
Block a user