Skip to content

Commit 2679c51

Browse files
Make handling of NotEnoughCash correct. (#1153)
1 parent b2ae9db commit 2679c51

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

core/src/consensus/consensus_inner/consensus_executor.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,6 +1118,21 @@ impl ConsensusExecutionHandler {
11181118
to_pending.push(transaction.clone());
11191119
}
11201120
}
1121+
Err(ExecutionError::NotEnoughCash {
1122+
required: _,
1123+
got: _,
1124+
actual_gas_cost,
1125+
}) => {
1126+
/* We charge `actual_gas_cost`, so increase
1127+
* `env.gas_used` to make
1128+
* this charged balance distributed to
1129+
* miners.
1130+
* Note for the case that `balance < tx_fee`,
1131+
* the amount
1132+
* of remainder is lost forever. */
1133+
env.gas_used +=
1134+
actual_gas_cost / transaction.gas_price;
1135+
}
11211136
Ok(ref executed) => {
11221137
env.gas_used = executed.cumulative_gas_used;
11231138
transaction_logs = executed.logs.clone();

0 commit comments

Comments
 (0)