Skip to content
This repository has been archived by the owner on Oct 22, 2023. It is now read-only.

Clarifying comments #906

Merged
merged 2 commits into from
Sep 27, 2019
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
11 changes: 7 additions & 4 deletions src/methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ pub mod execute {
return Err(TransactionError::DuplicateTransaction.into());
}

// Check whether transaction fits in the block.
// Check whether the transaction fits in the current block. If not, return
// an error indicating that the client should retry.
let gas_remaining = U256::from(BLOCK_GAS_LIMIT) - ectx.env_info.gas_used;
if tx.gas > gas_remaining {
return Err(TransactionError::BlockGasLimitReached.into());
Expand All @@ -79,8 +80,8 @@ pub mod execute {
&ectx.env_info,
genesis::SPEC.engine.machine(),
&tx,
false,
true,
false, /* tracing */
true, /* should_return_value */
)
.map_err(|err| TransactionError::ExecutionFailure {
message: format!("{}", err),
Expand All @@ -89,7 +90,9 @@ pub mod execute {
// Add to set of executed transactions.
ectx.transaction_set.insert(tx_hash);

// Update the amount of gas used in the current batch.
// Calculate the amount of gas used by this transaction and update the
// cumulative gas used for the batch. Note: receipt.gas_used is the cumulative
// gas used after executing the given transaction.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let gas_used = outcome.receipt.gas_used - ectx.env_info.gas_used;
ectx.env_info.gas_used = outcome.receipt.gas_used;

Expand Down