This commit is contained in:
bas-vk 2016-12-05 19:08:22 +00:00 committed by GitHub
commit 9b47a010aa
2 changed files with 6 additions and 2 deletions

View file

@ -97,7 +97,7 @@ func ApplyTransaction(config *params.ChainConfig, bc *BlockChain, gp *GasPool, s
return nil, nil, nil, err
}
_, gas, err := ApplyMessage(NewEnv(statedb, config, bc, msg, header, cfg), msg, gp)
ret, gas, err := ApplyMessage(NewEnv(statedb, config, bc, msg, header, cfg), msg, gp)
if err != nil {
return nil, nil, nil, err
}
@ -107,7 +107,9 @@ func ApplyTransaction(config *params.ChainConfig, bc *BlockChain, gp *GasPool, s
receipt := types.NewReceipt(statedb.IntermediateRoot(config.IsEIP158(header.Number)).Bytes(), usedGas)
receipt.TxHash = tx.Hash()
receipt.GasUsed = new(big.Int).Set(gas)
if MessageCreatesContract(msg) {
// ret is only not nil when the contract is deployed successful.
if MessageCreatesContract(msg) && ret != nil {
receipt.ContractAddress = crypto.CreateAddress(msg.From(), tx.Nonce())
}

View file

@ -235,6 +235,8 @@ func (self *StateTransition) TransitionDb() (ret []byte, requiredGas, usedGas *b
if err != nil {
ret = nil
glog.V(logger.Core).Infoln("VM create err:", err)
} else if ret == nil { // contract deployed without code
ret = []byte{}
}
} else {
// Increment the nonce for the next transaction