From 82beaabf6a8b5a146a38e1d6a31a78157c79a0cf Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 13 Jan 2015 14:57:51 +0100 Subject: [PATCH] Fixed consensus issue --- core/block_processor.go | 2 +- core/state_transition.go | 3 +-- tests/vm/gh_test.go | 1 - vm/vm_debug.go | 4 ++-- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/core/block_processor.go b/core/block_processor.go index 4d93fcead..6224d7c59 100644 --- a/core/block_processor.go +++ b/core/block_processor.go @@ -271,7 +271,7 @@ func (sm *BlockProcessor) AccumelateRewards(statedb *state.StateDB, block, paren reward := new(big.Int).Set(BlockReward) ancestors := set.New() - for _, ancestor := range sm.bc.GetAncestors(block, 6) { + for _, ancestor := range sm.bc.GetAncestors(block, 7) { ancestors.Add(string(ancestor.Hash())) } diff --git a/core/state_transition.go b/core/state_transition.go index b22c5bf21..8b0ca2ac4 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -192,8 +192,7 @@ func (self *StateTransition) TransitionState() (ret []byte, err error) { if err == nil { dataGas := big.NewInt(int64(len(ret))) dataGas.Mul(dataGas, vm.GasCreateByte) - if err = self.UseGas(dataGas); err == nil { - //self.state.SetCode(ref.Address(), ret) + if err := self.UseGas(dataGas); err == nil { ref.SetCode(ret) } } diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go index 7b41411de..e1fdcd658 100644 --- a/tests/vm/gh_test.go +++ b/tests/vm/gh_test.go @@ -79,7 +79,6 @@ func RunVmTest(p string, t *testing.T) { helper.CreateFileTests(t, p, &tests) for name, test := range tests { - //helper.Log.Infoln("Running", name) db, _ := ethdb.NewMemDatabase() statedb := state.New(nil, db) for addr, account := range test.Pre { diff --git a/vm/vm_debug.go b/vm/vm_debug.go index 255faefb0..5949ea5d9 100644 --- a/vm/vm_debug.go +++ b/vm/vm_debug.go @@ -663,8 +663,8 @@ func (self *DebugVm) Run(me, caller ContextRef, code []byte, value, gas, price * context.UseGas(context.Gas) - ret, err, ref := self.env.Create(context, addr, input, gas, price, value) - if err != nil { + ret, suberr, ref := self.env.Create(context, addr, input, gas, price, value) + if suberr != nil { stack.Push(ethutil.BigFalse) self.Printf("CREATE err %v", err)