Skip to content

Commit 2e28b50

Browse files
authoredDec 20, 2023
Merge pull request ProvableHQ#2260 from AleoHQ/feat/log-error
Add error logging on the finalize error
2 parents fd2f5b5 + 6013d5f commit 2e28b50

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed
 

‎synthesizer/src/vm/mod.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,16 @@ impl<N: Network, C: ConsensusStorage<N>> VM<N, C> {
327327
// Next, finalize the transactions.
328328
match self.finalize(state, block.ratifications(), block.solutions(), block.transactions()) {
329329
Ok(_ratified_finalize_operations) => Ok(()),
330-
Err(error) => {
330+
Err(finalize_error) => {
331331
// Rollback the block.
332-
self.block_store().remove_last_n(1)?;
333-
// Return the error.
334-
Err(error)
332+
self.block_store().remove_last_n(1).map_err(|removal_error| {
333+
// Log the finalize error.
334+
error!("Failed to finalize block {} - {finalize_error}", block.height());
335+
// Return the removal error.
336+
removal_error
337+
})?;
338+
// Return the finalize error.
339+
Err(finalize_error)
335340
}
336341
}
337342
}

0 commit comments

Comments
 (0)
Please sign in to comment.