diff options
author | obscuren <geffobscura@gmail.com> | 2014-03-31 07:03:28 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-03-31 07:03:28 +0800 |
commit | 7277c420479239fbea78417e42c43ee0162c2728 (patch) | |
tree | 71e87eca603437d569b78f9d64be80d537dcc034 /ethchain | |
parent | 7cc28c8b469ba8df8bad1e3bbbba7fbd99b88535 (diff) | |
download | go-tangerine-7277c420479239fbea78417e42c43ee0162c2728.tar go-tangerine-7277c420479239fbea78417e42c43ee0162c2728.tar.gz go-tangerine-7277c420479239fbea78417e42c43ee0162c2728.tar.bz2 go-tangerine-7277c420479239fbea78417e42c43ee0162c2728.tar.lz go-tangerine-7277c420479239fbea78417e42c43ee0162c2728.tar.xz go-tangerine-7277c420479239fbea78417e42c43ee0162c2728.tar.zst go-tangerine-7277c420479239fbea78417e42c43ee0162c2728.zip |
Fixed some state issues
Diffstat (limited to 'ethchain')
-rw-r--r-- | ethchain/state_manager.go | 6 | ||||
-rw-r--r-- | ethchain/transaction.go | 3 | ||||
-rw-r--r-- | ethchain/vm.go | 2 | ||||
-rw-r--r-- | ethchain/vm_test.go | 2 |
4 files changed, 7 insertions, 6 deletions
diff --git a/ethchain/state_manager.go b/ethchain/state_manager.go index 5c693442b..d9831d49f 100644 --- a/ethchain/state_manager.go +++ b/ethchain/state_manager.go @@ -82,7 +82,7 @@ func (sm *StateManager) WatchAddr(addr []byte) *AccountState { func (sm *StateManager) GetAddrState(addr []byte) *AccountState { account := sm.addrStateStore.Get(addr) if account == nil { - a := sm.bc.CurrentBlock.state.GetAccount(addr) + a := sm.procState.GetAccount(addr) account = &AccountState{Nonce: a.Nonce, Account: a} } @@ -128,9 +128,9 @@ func (sm *StateManager) ApplyTransactions(block *Block, txs []*Transaction) { // The prepare function, prepares the state manager for the next // "ProcessBlock" action. -func (sm *StateManager) Prepare(processer *State, comparative *State) { +func (sm *StateManager) Prepare(processor *State, comparative *State) { sm.compState = comparative - sm.procState = processer + sm.procState = processor } // Default prepare function diff --git a/ethchain/transaction.go b/ethchain/transaction.go index 9fdf55b4d..506e3c159 100644 --- a/ethchain/transaction.go +++ b/ethchain/transaction.go @@ -116,8 +116,9 @@ func (tx *Transaction) RlpData() interface{} { if !tx.contractCreation { data = append(data, tx.Recipient, tx.Gas) } + d := ethutil.NewSliceValue(tx.Data).Slice() - return append(data, ethutil.NewSliceValue(tx.Data).Slice(), tx.v, tx.r, tx.s) + return append(data, d, tx.v, tx.r, tx.s) } func (tx *Transaction) RlpValue() *ethutil.Value { diff --git a/ethchain/vm.go b/ethchain/vm.go index 18b7fe607..98aaa603a 100644 --- a/ethchain/vm.go +++ b/ethchain/vm.go @@ -115,6 +115,8 @@ func (vm *Vm) RunClosure(closure *Closure) []byte { } if closure.Gas.Cmp(gas) < 0 { + ethutil.Config.Log.Debugln("Insufficient gas", closure.Gas, gas) + return closure.Return(nil) } diff --git a/ethchain/vm_test.go b/ethchain/vm_test.go index 2a02bcf4c..838f12f56 100644 --- a/ethchain/vm_test.go +++ b/ethchain/vm_test.go @@ -94,9 +94,7 @@ func TestRun4(t *testing.T) { } store[0] = 20 - test = store[0] store[a] = 20 - f = store[400] `), false) if err != nil { fmt.Println(err) |