Commit 7277c420 authored by obscuren's avatar obscuren

Fixed some state issues

parent 7cc28c8b
...@@ -82,7 +82,7 @@ func (sm *StateManager) WatchAddr(addr []byte) *AccountState { ...@@ -82,7 +82,7 @@ func (sm *StateManager) WatchAddr(addr []byte) *AccountState {
func (sm *StateManager) GetAddrState(addr []byte) *AccountState { func (sm *StateManager) GetAddrState(addr []byte) *AccountState {
account := sm.addrStateStore.Get(addr) account := sm.addrStateStore.Get(addr)
if account == nil { if account == nil {
a := sm.bc.CurrentBlock.state.GetAccount(addr) a := sm.procState.GetAccount(addr)
account = &AccountState{Nonce: a.Nonce, Account: a} account = &AccountState{Nonce: a.Nonce, Account: a}
} }
...@@ -128,9 +128,9 @@ func (sm *StateManager) ApplyTransactions(block *Block, txs []*Transaction) { ...@@ -128,9 +128,9 @@ func (sm *StateManager) ApplyTransactions(block *Block, txs []*Transaction) {
// The prepare function, prepares the state manager for the next // The prepare function, prepares the state manager for the next
// "ProcessBlock" action. // "ProcessBlock" action.
func (sm *StateManager) Prepare(processer *State, comparative *State) { func (sm *StateManager) Prepare(processor *State, comparative *State) {
sm.compState = comparative sm.compState = comparative
sm.procState = processer sm.procState = processor
} }
// Default prepare function // Default prepare function
......
...@@ -116,8 +116,9 @@ func (tx *Transaction) RlpData() interface{} { ...@@ -116,8 +116,9 @@ func (tx *Transaction) RlpData() interface{} {
if !tx.contractCreation { if !tx.contractCreation {
data = append(data, tx.Recipient, tx.Gas) 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 { func (tx *Transaction) RlpValue() *ethutil.Value {
......
...@@ -115,6 +115,8 @@ func (vm *Vm) RunClosure(closure *Closure) []byte { ...@@ -115,6 +115,8 @@ func (vm *Vm) RunClosure(closure *Closure) []byte {
} }
if closure.Gas.Cmp(gas) < 0 { if closure.Gas.Cmp(gas) < 0 {
ethutil.Config.Log.Debugln("Insufficient gas", closure.Gas, gas)
return closure.Return(nil) return closure.Return(nil)
} }
......
...@@ -94,9 +94,7 @@ func TestRun4(t *testing.T) { ...@@ -94,9 +94,7 @@ func TestRun4(t *testing.T) {
} }
store[0] = 20 store[0] = 20
test = store[0]
store[a] = 20 store[a] = 20
f = store[400]
`), false) `), false)
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment