Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Spawn NodeExecutor before applying replay transactions #544

Merged
merged 1 commit into from
Jan 17, 2025
Merged
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
11 changes: 8 additions & 3 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,14 @@ async fn main() -> anyhow::Result<()> {
storage_key_layout,
);

// We start the node executor now so it can receive and handle commands
// during replay. Otherwise, replay would send commands and hang.
tokio::spawn(async move {
if let Err(err) = node_executor.run().await {
tracing::error!("node executor ended with error: {:?}", err);
}
});

if let Some(ref bytecodes_dir) = config.override_bytecodes_dir {
override_bytecodes(&node, bytecodes_dir.to_string())
.await
Expand Down Expand Up @@ -391,9 +399,6 @@ async fn main() -> anyhow::Result<()> {
_ = any_server_stopped => {
tracing::trace!("node server was stopped")
},
_ = node_executor.run() => {
tracing::trace!("node executor was stopped")
},
_ = block_sealer.run() => {
tracing::trace!("block sealer was stopped")
},
Expand Down
4 changes: 2 additions & 2 deletions crates/core/src/node/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,12 @@ impl InMemoryNode {
.iter()
.map(|tx| tx.hash())
.collect::<HashSet<_>>();
let block_numer = self.node_handle.seal_block_sync(tx_batch).await?;
let block_number = self.node_handle.seal_block_sync(tx_batch).await?;

// Fetch the block that was just sealed
let block = self
.blockchain
.get_block_by_number(block_numer)
.get_block_by_number(block_number)
.await
.expect("freshly sealed block could not be found in storage");

Expand Down
Loading