Skip to content

Commit

Permalink
fix: replaying transactions fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
dutterbutter committed Jan 16, 2025
1 parent bb90831 commit ee1f557
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
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

0 comments on commit ee1f557

Please sign in to comment.