Fix for requesting initResults after contract creation

This commit is contained in:
nicksavers 2014-07-09 14:05:57 +02:00
parent 402c64d4c0
commit 85371f289d

View File

@ -188,8 +188,9 @@ public class WorldManager {
} }
byte[] code; byte[] code;
boolean isContractCreation = tx.isContractCreation();
// 3. FIND OUT THE TRANSACTION TYPE // 3. FIND OUT THE TRANSACTION TYPE
if (tx.isContractCreation()) { if (isContractCreation) {
code = tx.getData(); // init code code = tx.getData(); // init code
if (logger.isInfoEnabled()) if (logger.isInfoEnabled())
logger.info("running the init for contract: address={}", logger.info("running the init for contract: address={}",
@ -203,7 +204,7 @@ public class WorldManager {
} }
} }
if (code != null) { if (isContractCreation || code != null) {
Block lastBlock = blockchain.getLastBlock(); Block lastBlock = blockchain.getLastBlock();
ProgramInvoke programInvoke = ProgramInvokeFactory ProgramInvoke programInvoke = ProgramInvokeFactory
@ -214,7 +215,7 @@ public class WorldManager {
vm.play(program); vm.play(program);
ProgramResult result = program.getResult(); ProgramResult result = program.getResult();
applyProgramResult(result, gasDebit, trackRepository, applyProgramResult(result, gasDebit, trackRepository,
senderAddress, receiverAddress, coinbase, true); senderAddress, receiverAddress, coinbase, isContractCreation);
} }
} catch (RuntimeException e) { } catch (RuntimeException e) {
trackRepository.rollback(); trackRepository.rollback();