Skip to content

Commit 7388d66

Browse files
authored
docs(config): clarify PruneConfig::merge semantics (#20235)
1 parent 0b859c0 commit 7388d66

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

crates/config/src/config.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,12 @@ impl PruneConfig {
531531
self.segments.receipts.is_some() || !self.segments.receipts_log_filter.is_empty()
532532
}
533533

534-
/// Merges another `PruneConfig` into this one, taking values from the other config if and only
535-
/// if the corresponding value in this config is not set.
534+
/// Merges values from `other` into `self`.
535+
/// - `Option<PruneMode>` fields: set from `other` only if `self` is `None`.
536+
/// - `block_interval`: set from `other` only if `self.block_interval ==
537+
/// DEFAULT_BLOCK_INTERVAL`.
538+
/// - `merkle_changesets`: always set from `other`.
539+
/// - `receipts_log_filter`: set from `other` only if `self` is empty and `other` is non-empty.
536540
pub fn merge(&mut self, other: Self) {
537541
let Self {
538542
block_interval,
@@ -561,7 +565,7 @@ impl PruneConfig {
561565
self.segments.account_history = self.segments.account_history.or(account_history);
562566
self.segments.storage_history = self.segments.storage_history.or(storage_history);
563567
self.segments.bodies_history = self.segments.bodies_history.or(bodies_history);
564-
// Merkle changesets is not optional, so we just replace it if provided
568+
// Merkle changesets is not optional; always take the value from `other`
565569
self.segments.merkle_changesets = merkle_changesets;
566570

567571
if self.segments.receipts_log_filter.0.is_empty() && !receipts_log_filter.0.is_empty() {

0 commit comments

Comments
 (0)