mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: convert hash field to OnceLock<TxHash> on TransactionSigned (#12596)
Co-authored-by: joshieDo <93316087+joshieDo@users.noreply.github.com>
This commit is contained in:
@ -43,7 +43,7 @@ impl BlobStoreCanonTracker {
|
||||
.body
|
||||
.transactions()
|
||||
.filter(|tx| tx.transaction.is_eip4844())
|
||||
.map(|tx| tx.hash);
|
||||
.map(|tx| tx.hash());
|
||||
(*num, iter)
|
||||
});
|
||||
self.add_blocks(blob_txs);
|
||||
@ -128,18 +128,18 @@ mod tests {
|
||||
body: BlockBody {
|
||||
transactions: vec![
|
||||
TransactionSigned {
|
||||
hash: tx1_hash,
|
||||
hash: tx1_hash.into(),
|
||||
transaction: Transaction::Eip4844(Default::default()),
|
||||
..Default::default()
|
||||
},
|
||||
TransactionSigned {
|
||||
hash: tx2_hash,
|
||||
hash: tx2_hash.into(),
|
||||
transaction: Transaction::Eip4844(Default::default()),
|
||||
..Default::default()
|
||||
},
|
||||
// Another transaction that is not EIP-4844
|
||||
TransactionSigned {
|
||||
hash: B256::random(),
|
||||
hash: B256::random().into(),
|
||||
transaction: Transaction::Eip7702(Default::default()),
|
||||
..Default::default()
|
||||
},
|
||||
@ -161,12 +161,12 @@ mod tests {
|
||||
body: BlockBody {
|
||||
transactions: vec![
|
||||
TransactionSigned {
|
||||
hash: tx3_hash,
|
||||
hash: tx3_hash.into(),
|
||||
transaction: Transaction::Eip1559(Default::default()),
|
||||
..Default::default()
|
||||
},
|
||||
TransactionSigned {
|
||||
hash: tx2_hash,
|
||||
hash: tx2_hash.into(),
|
||||
transaction: Transaction::Eip2930(Default::default()),
|
||||
..Default::default()
|
||||
},
|
||||
|
||||
@ -317,7 +317,7 @@ pub async fn maintain_transaction_pool<Client, P, St, Tasks>(
|
||||
// find all transactions that were mined in the old chain but not in the new chain
|
||||
let pruned_old_transactions = old_blocks
|
||||
.transactions_ecrecovered()
|
||||
.filter(|tx| !new_mined_transactions.contains(&tx.hash))
|
||||
.filter(|tx| !new_mined_transactions.contains(tx.hash_ref()))
|
||||
.filter_map(|tx| {
|
||||
if tx.is_eip4844() {
|
||||
// reorged blobs no longer include the blob, which is necessary for
|
||||
@ -325,7 +325,7 @@ pub async fn maintain_transaction_pool<Client, P, St, Tasks>(
|
||||
// been validated previously, we still need the blob in order to
|
||||
// accurately set the transaction's
|
||||
// encoded-length which is propagated over the network.
|
||||
pool.get_blob(tx.hash)
|
||||
pool.get_blob(TransactionSigned::hash(&tx))
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(Arc::unwrap_or_clone)
|
||||
|
||||
@ -911,7 +911,7 @@ impl From<PooledTransactionsElementEcRecovered> for MockTransaction {
|
||||
impl From<MockTransaction> for TransactionSignedEcRecovered {
|
||||
fn from(tx: MockTransaction) -> Self {
|
||||
let signed_tx = TransactionSigned {
|
||||
hash: *tx.hash(),
|
||||
hash: (*tx.hash()).into(),
|
||||
signature: Signature::test_signature(),
|
||||
transaction: tx.clone().into(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user