Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/cli/commands/src/db/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ impl Command {
receipts_in_static_files: _,
transaction_senders_in_static_files: _,
storages_history_in_rocksdb: _,
transaction_hash_numbers_in_rocksdb: _,
} = settings.unwrap_or_else(StorageSettings::legacy);

// Update the setting based on the key
Expand Down
10 changes: 10 additions & 0 deletions crates/storage/db-api/src/models/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ pub struct StorageSettings {
/// Whether `StoragesHistory` is stored in `RocksDB`.
#[serde(default)]
pub storages_history_in_rocksdb: bool,
/// Whether `TransactionHashNumbers` is stored in `RocksDB`.
#[serde(default)]
pub transaction_hash_numbers_in_rocksdb: bool,
}

impl StorageSettings {
Expand All @@ -35,6 +38,7 @@ impl StorageSettings {
receipts_in_static_files: false,
transaction_senders_in_static_files: false,
storages_history_in_rocksdb: false,
transaction_hash_numbers_in_rocksdb: false,
}
}

Expand All @@ -55,4 +59,10 @@ impl StorageSettings {
self.storages_history_in_rocksdb = value;
self
}

/// Sets the `transaction_hash_numbers_in_rocksdb` flag to the provided value.
pub const fn with_transaction_hash_numbers_in_rocksdb(mut self, value: bool) -> Self {
self.transaction_hash_numbers_in_rocksdb = value;
self
}
}
14 changes: 14 additions & 0 deletions crates/transaction-pool/src/pool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,20 @@ where
.collect()
}

/// Returns only the first `max` hashes of transactions in the pool that can be propagated.
pub fn pooled_transactions_hashes_max(&self, max: usize) -> Vec<TxHash> {
if max == 0 {
return Vec::new();
}
self.get_pool_data()
.all()
.transactions_iter()
.filter(|tx| tx.propagate)
.take(max)
.map(|tx| *tx.hash())
.collect()
}

/// Converts the internally tracked transaction to the pooled format.
///
/// If the transaction is an EIP-4844 transaction, the blob sidecar is fetched from the blob
Expand Down
Loading