Skip to content

Commit

Permalink
Merge 2f1f82d into e54131f
Browse files Browse the repository at this point in the history
  • Loading branch information
zilm13 committed Apr 1, 2019
2 parents e54131f + 2f1f82d commit afd54ac
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions ethereumj-core/src/main/java/org/ethereum/vm/program/Program.java
Expand Up @@ -549,16 +549,9 @@ private void createContractImpl(DataWord value, byte[] programCode, byte[] newAd
}

// 4. CREATE THE CONTRACT OUT OF RETURN
byte[] code = result.getHReturn();

long storageCost = getLength(code) * getBlockchainConfig().getGasCost().getCREATE_DATA();
if (result.isRevert()) {
long afterSpend = programInvoke.getGas().longValue() - result.getGasUsed();
if (afterSpend < 0) {
result.setException(Program.Exception.notEnoughSpendingGas("No gas to return just created contract",
storageCost, this));
}
} else {
if (!result.isRevert() && result.getException() == null) {
byte[] code = result.getHReturn();
long storageCost = getLength(code) * getBlockchainConfig().getGasCost().getCREATE_DATA();
long afterSpend = programInvoke.getGas().longValue() - result.getGasUsed() - storageCost;
if (afterSpend < 0) {
if (!blockchainConfig.getConstants().createEmptyContractOnOOG()) {
Expand Down

0 comments on commit afd54ac

Please sign in to comment.