diff options
author | obscuren <geffobscura@gmail.com> | 2014-07-15 06:25:49 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-07-15 06:25:49 +0800 |
commit | 2784e256f1c5f8112486e9037c9b00e628e5aa10 (patch) | |
tree | fc4740c381d00efa5777159c129ab9ad2c2836dc /ethchain | |
parent | 50bc838047709796596f447ef3e60d0e4ab47fde (diff) | |
download | dexon-2784e256f1c5f8112486e9037c9b00e628e5aa10.tar dexon-2784e256f1c5f8112486e9037c9b00e628e5aa10.tar.gz dexon-2784e256f1c5f8112486e9037c9b00e628e5aa10.tar.bz2 dexon-2784e256f1c5f8112486e9037c9b00e628e5aa10.tar.lz dexon-2784e256f1c5f8112486e9037c9b00e628e5aa10.tar.xz dexon-2784e256f1c5f8112486e9037c9b00e628e5aa10.tar.zst dexon-2784e256f1c5f8112486e9037c9b00e628e5aa10.zip |
Vm logging on diff
Diffstat (limited to 'ethchain')
-rw-r--r-- | ethchain/state_manager.go | 2 | ||||
-rw-r--r-- | ethchain/transaction.go | 4 | ||||
-rw-r--r-- | ethchain/vm.go | 10 |
3 files changed, 7 insertions, 9 deletions
diff --git a/ethchain/state_manager.go b/ethchain/state_manager.go index d52e418ce..129b30ba6 100644 --- a/ethchain/state_manager.go +++ b/ethchain/state_manager.go @@ -196,7 +196,7 @@ func (sm *StateManager) Process(block *Block, dontReact bool) (err error) { fmt.Printf("## %x %x ##\n", block.Hash(), block.Number) } - receipts, err := sm.ApplyDiff(state, parent, block) + _, err = sm.ApplyDiff(state, parent, block) if err != nil { return err } diff --git a/ethchain/transaction.go b/ethchain/transaction.go index 0b4f8d1a4..5686a7edb 100644 --- a/ethchain/transaction.go +++ b/ethchain/transaction.go @@ -232,10 +232,6 @@ func (self *Receipt) Cmp(other *Receipt) bool { return false } - if self.CumulativeGasUsed.Cmp(other.CumulativeGasUsed) != 0 { - return false - } - return true } diff --git a/ethchain/vm.go b/ethchain/vm.go index f1794ff77..788bde886 100644 --- a/ethchain/vm.go +++ b/ethchain/vm.go @@ -184,7 +184,8 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) { var mult *big.Int y, x := stack.Peekn() val := closure.GetStorage(x) - if val.IsEmpty() && len(y.Bytes()) > 0 { + //if val.IsEmpty() && len(y.Bytes()) > 0 { + if val.BigInt().Cmp(ethutil.Big0) == 0 && len(y.Bytes()) > 0 { mult = ethutil.Big2 } else if !val.IsEmpty() && len(y.Bytes()) == 0 { mult = ethutil.Big0 @@ -482,7 +483,7 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) { case ORIGIN: stack.Push(ethutil.BigD(vm.vars.Origin)) - vm.Printf(" => %v", vm.vars.Origin) + vm.Printf(" => %x", vm.vars.Origin) case CALLER: caller := closure.caller.Address() stack.Push(ethutil.BigD(caller)) @@ -550,10 +551,10 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) { } code := closure.Script[cOff : cOff+l] - fmt.Println("len:", l, "code off:", cOff, "mem off:", mOff) + //fmt.Println("len:", l, "code off:", cOff, "mem off:", mOff) mem.Set(mOff, l, code) - fmt.Println(Code(mem.Get(mOff, l))) + //fmt.Println(Code(mem.Get(mOff, l))) case GASPRICE: stack.Push(closure.Price) @@ -743,6 +744,7 @@ func (vm *Vm) RunClosure(closure *Closure) (ret []byte, err error) { if closure.object.Amount.Cmp(value) < 0 { vmlogger.Debugf("Insufficient funds to transfer value. Req %v, has %v", value, closure.object.Amount) + closure.ReturnGas(gas, nil, nil) stack.Push(ethutil.BigFalse) |