aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-07-02 06:06:21 +0800
committerobscuren <geffobscura@gmail.com>2014-07-02 06:06:21 +0800
commit1954ef47e67762f0308544e3a17976e4c3927e32 (patch)
tree6c67c4ca85b9b4020a4afe8028f4aa1978ef6c40
parentfd1d0bbde7e76b3376a3a932930bc099f223d8ff (diff)
downloaddexon-1954ef47e67762f0308544e3a17976e4c3927e32.tar.gz
dexon-1954ef47e67762f0308544e3a17976e4c3927e32.tar.zst
dexon-1954ef47e67762f0308544e3a17976e4c3927e32.zip
Suicide is deferred to update
-rw-r--r--ethchain/vm.go16
-rw-r--r--ethutil/bytes.go4
2 files changed, 12 insertions, 8 deletions
diff --git a/ethchain/vm.go b/ethchain/vm.go
index c5ccb3420..0b8799a12 100644
--- a/ethchain/vm.go
+++ b/ethchain/vm.go
@@ -150,7 +150,7 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
case SSTORE:
var mult *big.Int
y, x := stack.Peekn()
- val := closure.GetMem(x)
+ val := closure.GetStorage(x)
if val.IsEmpty() && len(y.Bytes()) > 0 {
mult = ethutil.Big2
} else if !val.IsEmpty() && len(y.Bytes()) == 0 {
@@ -567,7 +567,7 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
case SLOAD:
require(1)
loc := stack.Pop()
- val := closure.GetMem(loc)
+ val := closure.GetStorage(loc)
stack.Push(val.BigInt())
@@ -713,10 +713,14 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
receiver := vm.state.GetAccount(stack.Pop().Bytes())
receiver.AddAmount(closure.object.Amount)
- trie := closure.object.state.trie
- trie.NewIterator().Each(func(key string, v *ethutil.Value) {
- trie.Delete(key)
- })
+ closure.object.MarkForDeletion()
+
+ /*
+ trie := closure.object.state.trie
+ trie.NewIterator().Each(func(key string, v *ethutil.Value) {
+ trie.Delete(key)
+ })
+ */
fallthrough
case STOP: // Stop the closure
diff --git a/ethutil/bytes.go b/ethutil/bytes.go
index ad60e62fd..d68a69433 100644
--- a/ethutil/bytes.go
+++ b/ethutil/bytes.go
@@ -129,7 +129,7 @@ func FormatData(data string) []byte {
}
func RightPadBytes(slice []byte, l int) []byte {
- if l <= len(slice) {
+ if l < len(slice) {
return slice
}
@@ -140,7 +140,7 @@ func RightPadBytes(slice []byte, l int) []byte {
}
func LeftPadBytes(slice []byte, l int) []byte {
- if l <= len(slice) {
+ if l < len(slice) {
return slice
}