mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: order transactions by nonce before inserting into txpool (#4989)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -541,7 +541,8 @@ where
|
||||
.0
|
||||
.into_iter()
|
||||
.map(PooledTransactionsElement::try_from_broadcast)
|
||||
.filter_map(Result::ok);
|
||||
.filter_map(Result::ok)
|
||||
.collect();
|
||||
|
||||
self.import_transactions(peer_id, non_blob_txs, TransactionSource::Broadcast);
|
||||
|
||||
@ -644,7 +645,7 @@ where
|
||||
fn import_transactions(
|
||||
&mut self,
|
||||
peer_id: PeerId,
|
||||
transactions: impl IntoIterator<Item = PooledTransactionsElement>,
|
||||
transactions: Vec<PooledTransactionsElement>,
|
||||
source: TransactionSource,
|
||||
) {
|
||||
// If the node is pipeline syncing, ignore transactions
|
||||
|
||||
@ -734,6 +734,7 @@ where
|
||||
// we can't fit this _blob_ transaction into the block, so we mark it as invalid,
|
||||
// which removes its dependent transactions from the iterator. This is similar to
|
||||
// the gas limit condition for regular transactions above.
|
||||
trace!(target: "payload_builder", tx=?tx.hash, ?sum_blob_gas_used, ?tx_blob_gas, "skipping blob transaction because it would exceed the max data gas per block");
|
||||
best_txs.mark_invalid(&pool_tx);
|
||||
continue
|
||||
}
|
||||
|
||||
@ -88,6 +88,16 @@ impl PooledTransactionsElement {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the transaction nonce.
|
||||
pub fn nonce(&self) -> u64 {
|
||||
match self {
|
||||
Self::Legacy { transaction, .. } => transaction.nonce,
|
||||
Self::Eip2930 { transaction, .. } => transaction.nonce,
|
||||
Self::Eip1559 { transaction, .. } => transaction.nonce,
|
||||
Self::BlobTransaction(blob_tx) => blob_tx.transaction.nonce,
|
||||
}
|
||||
}
|
||||
|
||||
/// Recover signer from signature and hash.
|
||||
///
|
||||
/// Returns `None` if the transaction's signature is invalid, see also [Self::recover_signer].
|
||||
|
||||
Reference in New Issue
Block a user