From 0b33d890240e1bfee78e092cf6f633d18ac40128 Mon Sep 17 00:00:00 2001 From: Jernej Kos Date: Wed, 9 Mar 2022 18:35:52 +0100 Subject: [PATCH] runtime: Commit check transaction results for subsequent batches --- .changelog/4557.bugfix.md | 1 + runtime/src/dispatcher.rs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changelog/4557.bugfix.md diff --git a/.changelog/4557.bugfix.md b/.changelog/4557.bugfix.md new file mode 100644 index 00000000000..2fd4df03d9b --- /dev/null +++ b/.changelog/4557.bugfix.md @@ -0,0 +1 @@ +runtime: Commit check transaction results for subsequent batches diff --git a/runtime/src/dispatcher.rs b/runtime/src/dispatcher.rs index 6927d68b6de..282fbf1eeb2 100644 --- a/runtime/src/dispatcher.rs +++ b/runtime/src/dispatcher.rs @@ -519,7 +519,7 @@ impl Dispatcher { let mut overlay = OverlayTree::new(cache.tree_mut()); let txn_ctx = TxnContext::new( - ctx, + ctx.clone(), protocol, consensus_state, &mut overlay, @@ -531,6 +531,10 @@ impl Dispatcher { ); let results = txn_dispatcher.check_batch(txn_ctx, &inputs); + // Commit results to in-memory tree so they persist for subsequent batches that are based on + // the same block. + let _ = overlay.commit(Context::create_child(&ctx)).unwrap(); + debug!(self.logger, "Transaction batch check complete"); results.map(|results| Body::RuntimeCheckTxBatchResponse { results })