Skip to content

Commit 0e9ad65

Browse files
committed
runtime: Make persistent transaction check state configurable
1 parent 4af3e74 commit 0e9ad65

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

.changelog/4640.feature.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
runtime: Make persistent transaction check state configurable

runtime/src/config.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ pub struct Config {
1212
pub storage: Storage,
1313
/// Advertised runtime features.
1414
pub features: Option<Features>,
15+
/// Whether storage state should be persisted between transaction check invocations. The state
16+
/// is invalidated on the next round.
17+
pub persist_check_tx_state: bool,
1518
}
1619

1720
/// Storage-related configuration.

runtime/src/dispatcher.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ impl Dispatcher {
520520

521521
let txn_ctx = TxnContext::new(
522522
ctx.clone(),
523-
protocol,
523+
protocol.clone(),
524524
consensus_state,
525525
&mut overlay,
526526
&state.header,
@@ -531,9 +531,11 @@ impl Dispatcher {
531531
);
532532
let results = txn_dispatcher.check_batch(txn_ctx, &inputs);
533533

534-
// Commit results to in-memory tree so they persist for subsequent batches that are based on
535-
// the same block.
536-
let _ = overlay.commit(Context::create_child(&ctx)).unwrap();
534+
if protocol.get_config().persist_check_tx_state {
535+
// Commit results to in-memory tree so they persist for subsequent batches that are
536+
// based on the same block.
537+
let _ = overlay.commit(Context::create_child(&ctx)).unwrap();
538+
}
537539

538540
debug!(self.logger, "Transaction batch check complete");
539541

0 commit comments

Comments
 (0)