Skip to content

Commit

Permalink
Early set operation id (#4758)
Browse files Browse the repository at this point in the history
  • Loading branch information
sydhds authored Oct 9, 2024
1 parent 99ce8b7 commit e55fd9a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions massa-execution-worker/src/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,11 @@ impl ExecutionState {
.saturating_sub(operation.get_max_spending(self.config.roll_price)),
);

// set the context origin operation ID
// Note: set operation ID early as if context.transfer_coins fails, event_create will use
// operation ID in the event message
context.origin_operation_id = Some(operation_id);

// debit the fee from the operation sender
if let Err(err) =
context.transfer_coins(Some(sender_addr), None, operation.content.fee, false)
Expand All @@ -478,9 +483,6 @@ impl ExecutionState {
// set the creator address
context.creator_address = Some(operation.content_creator_address);

// set the context origin operation ID
context.origin_operation_id = Some(operation_id);

Ok(context_snapshot)
}

Expand Down

0 comments on commit e55fd9a

Please sign in to comment.