Skip to content

Commit ab28e49

Browse files
Evalirclaude
andauthored
refactor(node): bundle set_with_head and set_backfill_thresholds into configure_notifications (#92)
The two calls were always paired across 4 call sites in set_exex_head. Bundling them into a single helper eliminates the risk of forgetting to pair them when adding new code paths. ENG-1959 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4191add commit ab28e49

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

crates/node/src/node.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,7 @@ where
242242
match host_deployment_block {
243243
Some(genesis_block) => {
244244
let exex_head = ExExHead { block: genesis_block.num_hash_slow() };
245-
self.host.notifications.set_with_head(exex_head);
246-
self.set_backfill_thresholds();
245+
self.configure_notifications(exex_head);
247246
return Ok(exex_head);
248247
}
249248
None => {
@@ -256,8 +255,7 @@ where
256255
match genesis_block {
257256
Some(genesis_block) => {
258257
let exex_head = ExExHead { block: genesis_block.num_hash_slow() };
259-
self.host.notifications.set_with_head(exex_head);
260-
self.set_backfill_thresholds();
258+
self.configure_notifications(exex_head);
261259
return Ok(exex_head);
262260
}
263261
None => panic!("failed to find genesis block"),
@@ -275,8 +273,7 @@ where
275273
Some(host_block) => {
276274
debug!(host_height, "found host block for height");
277275
let exex_head = ExExHead { block: host_block.num_hash_slow() };
278-
self.host.notifications.set_with_head(exex_head);
279-
self.set_backfill_thresholds();
276+
self.configure_notifications(exex_head);
280277
Ok(exex_head)
281278
}
282279
None => {
@@ -285,8 +282,7 @@ where
285282
match genesis_block {
286283
Some(genesis_block) => {
287284
let exex_head = ExExHead { block: genesis_block.num_hash_slow() };
288-
self.host.notifications.set_with_head(exex_head);
289-
self.set_backfill_thresholds();
285+
self.configure_notifications(exex_head);
290286
Ok(exex_head)
291287
}
292288
None => panic!("failed to find genesis block"),
@@ -295,10 +291,11 @@ where
295291
}
296292
}
297293

298-
/// Sets backfill thresholds to limit memory usage during sync.
299-
/// This should be called after `set_with_head` to configure how many
300-
/// blocks can be processed per backfill batch.
301-
fn set_backfill_thresholds(&mut self) {
294+
/// Configures the ExEx notification stream with the given head and
295+
/// backfill thresholds from the node config.
296+
fn configure_notifications(&mut self, exex_head: ExExHead) {
297+
self.host.notifications.set_with_head(exex_head);
298+
302299
let max_blocks = self.config.backfill_max_blocks();
303300
let max_duration = self.config.backfill_max_duration();
304301
self.host.notifications.set_backfill_thresholds(ExecutionStageThresholds {

0 commit comments

Comments
 (0)