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

Receipt saving bug #177

Merged
merged 3 commits into from
Feb 17, 2022
Merged
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
16 changes: 8 additions & 8 deletions fuel-core/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,18 @@ impl Executor {
// execute vm
let mut vm = Transactor::new(tx_db.clone());
vm.transact(tx);

match vm.result() {
Ok(result) => {
// only commit state changes if execution was a success
if !result.should_revert() {
sub_tx.commit()?;
}
// persist any outputs
self.persist_outputs(block.fuel_height, result.tx(), tx_db)?;
self.persist_outputs(block.fuel_height, result.tx(), block_tx.deref_mut())?;

// persist receipts
self.persist_receipts(tx_id, result.receipts(), tx_db)?;
self.persist_receipts(tx_id, result.receipts(), block_tx.deref_mut())?;

let status = if result.should_revert() {
if config.backtrace {
Expand Down Expand Up @@ -104,14 +109,9 @@ impl Executor {

// persist tx status at the block level
block_tx.update_tx_status(tx_id, status)?;

// only commit state changes if execution was a success
if !result.should_revert() {
sub_tx.commit()?;
}
}
Err(e) => {
// save error status on block_tx since the sub_tx changes are dropped
// save error status on block_tx
block_tx.update_tx_status(
tx_id,
TransactionStatus::Failed {
Expand Down