diff options
author | obscuren <geffobscura@gmail.com> | 2014-07-01 02:03:31 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-07-01 02:03:31 +0800 |
commit | ed276cd7c241749a9cf8add4e2fae3d3608a7ea4 (patch) | |
tree | 40416177aeac9874e0eecdb7194db9bc13e39174 /ethutil/trie.go | |
parent | 82272ee08a7d72be1cc0947b6a0e8096a0353362 (diff) | |
download | go-tangerine-ed276cd7c241749a9cf8add4e2fae3d3608a7ea4.tar go-tangerine-ed276cd7c241749a9cf8add4e2fae3d3608a7ea4.tar.gz go-tangerine-ed276cd7c241749a9cf8add4e2fae3d3608a7ea4.tar.bz2 go-tangerine-ed276cd7c241749a9cf8add4e2fae3d3608a7ea4.tar.lz go-tangerine-ed276cd7c241749a9cf8add4e2fae3d3608a7ea4.tar.xz go-tangerine-ed276cd7c241749a9cf8add4e2fae3d3608a7ea4.tar.zst go-tangerine-ed276cd7c241749a9cf8add4e2fae3d3608a7ea4.zip |
Added Paranoia check for VM execution
Diffstat (limited to 'ethutil/trie.go')
-rw-r--r-- | ethutil/trie.go | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/ethutil/trie.go b/ethutil/trie.go index c669bdcb0..56f1648a6 100644 --- a/ethutil/trie.go +++ b/ethutil/trie.go @@ -173,10 +173,13 @@ func (t *Trie) Update(key string, value string) { k := CompactHexDecode(key) root := t.UpdateState(t.Root, k, value) - if _, ok := root.([]byte); !ok { - t.Root = t.cache.PutValue(root, true) - } else { + switch root.(type) { + case string: t.Root = root + case []byte: + t.Root = root + default: + t.Root = t.cache.PutValue(root, true) } } @@ -197,10 +200,13 @@ func (t *Trie) Delete(key string) { k := CompactHexDecode(key) root := t.DeleteState(t.Root, k) - if _, ok := root.([]byte); !ok { - t.Root = t.cache.PutValue(root, true) - } else { + switch root.(type) { + case string: t.Root = root + case []byte: + t.Root = root + default: + t.Root = t.cache.PutValue(root, true) } } |