aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-24 22:23:16 +0800
committerobscuren <geffobscura@gmail.com>2015-03-24 22:23:16 +0800
commitff9d66e096e853883c269b41cc94b17d4bc95261 (patch)
treebb22f066b13880d53b40b87c5695568bc799a4f9 /core
parent23bccbbc587aa22057eb7ae29c5b87d44b7cac7d (diff)
downloadgo-tangerine-ff9d66e096e853883c269b41cc94b17d4bc95261.tar
go-tangerine-ff9d66e096e853883c269b41cc94b17d4bc95261.tar.gz
go-tangerine-ff9d66e096e853883c269b41cc94b17d4bc95261.tar.bz2
go-tangerine-ff9d66e096e853883c269b41cc94b17d4bc95261.tar.lz
go-tangerine-ff9d66e096e853883c269b41cc94b17d4bc95261.tar.xz
go-tangerine-ff9d66e096e853883c269b41cc94b17d4bc95261.tar.zst
go-tangerine-ff9d66e096e853883c269b41cc94b17d4bc95261.zip
Cleaned up changes
Diffstat (limited to 'core')
-rw-r--r--core/state_transition.go7
-rw-r--r--core/vm/environment.go3
-rw-r--r--core/vm/vm.go2
-rw-r--r--core/vm_env.go6
4 files changed, 7 insertions, 11 deletions
diff --git a/core/state_transition.go b/core/state_transition.go
index 6312dee88..10a49f829 100644
--- a/core/state_transition.go
+++ b/core/state_transition.go
@@ -195,14 +195,10 @@ func (self *StateTransition) transitionState() (ret []byte, usedGas *big.Int, er
return nil, nil, InvalidTxError(err)
}
- // Increment the nonce for the next transaction
-
vmenv := self.env
var ref vm.ContextRef
if MessageCreatesContract(msg) {
- //contract := makeContract(msg, self.state)
- //addr := contract.Address()
- ret, err, ref = vmenv.Create(sender, nil, self.msg.Data(), self.gas, self.gasPrice, self.value)
+ ret, err, ref = vmenv.Create(sender, self.msg.Data(), self.gas, self.gasPrice, self.value)
if err == nil {
dataGas := big.NewInt(int64(len(ret)))
dataGas.Mul(dataGas, vm.GasCreateByte)
@@ -213,6 +209,7 @@ func (self *StateTransition) transitionState() (ret []byte, usedGas *big.Int, er
}
}
} else {
+ // Increment the nonce for the next transaction
self.state.SetNonce(sender.Address(), sender.Nonce()+1)
ret, err = vmenv.Call(self.From(), self.To().Address(), self.msg.Data(), self.gas, self.gasPrice, self.value)
}
diff --git a/core/vm/environment.go b/core/vm/environment.go
index 6c5202185..72e18c353 100644
--- a/core/vm/environment.go
+++ b/core/vm/environment.go
@@ -31,7 +31,7 @@ type Environment interface {
Call(me ContextRef, addr common.Address, data []byte, gas, price, value *big.Int) ([]byte, error)
CallCode(me ContextRef, addr common.Address, data []byte, gas, price, value *big.Int) ([]byte, error)
- Create(me ContextRef, addr *common.Address, data []byte, gas, price, value *big.Int) ([]byte, error, ContextRef)
+ Create(me ContextRef, data []byte, gas, price, value *big.Int) ([]byte, error, ContextRef)
}
type Account interface {
@@ -43,7 +43,6 @@ type Account interface {
// generic transfer method
func Transfer(from, to Account, amount *big.Int) error {
- //fmt.Printf(":::%x::: %v < %v\n", from.Address(), from.Balance(), amount)
if from.Balance().Cmp(amount) < 0 {
return errors.New("Insufficient balance in account")
}
diff --git a/core/vm/vm.go b/core/vm/vm.go
index 2ece5b928..562689dca 100644
--- a/core/vm/vm.go
+++ b/core/vm/vm.go
@@ -636,7 +636,7 @@ func (self *Vm) Run(context *Context, callData []byte) (ret []byte, err error) {
self.Endl()
context.UseGas(context.Gas)
- ret, suberr, ref := self.env.Create(context, nil, input, gas, price, value)
+ ret, suberr, ref := self.env.Create(context, input, gas, price, value)
if suberr != nil {
stack.push(common.BigFalse)
diff --git a/core/vm_env.go b/core/vm_env.go
index d786844dc..52e8b20a9 100644
--- a/core/vm_env.go
+++ b/core/vm_env.go
@@ -4,8 +4,8 @@ import (
"math/big"
"github.com/ethereum/go-ethereum/common"
- "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/state"
+ "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
)
@@ -68,7 +68,7 @@ func (self *VMEnv) CallCode(me vm.ContextRef, addr common.Address, data []byte,
return exe.Call(addr, me)
}
-func (self *VMEnv) Create(me vm.ContextRef, addr *common.Address, data []byte, gas, price, value *big.Int) ([]byte, error, vm.ContextRef) {
- exe := self.vm(addr, data, gas, price, value)
+func (self *VMEnv) Create(me vm.ContextRef, data []byte, gas, price, value *big.Int) ([]byte, error, vm.ContextRef) {
+ exe := self.vm(nil, data, gas, price, value)
return exe.Create(me)
}