aboutsummaryrefslogtreecommitdiffstats
path: root/trie/trie.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-11-18 19:03:09 +0800
committerobscuren <geffobscura@gmail.com>2014-11-18 19:03:09 +0800
commit3220a32ff056f5bffed031bf1c4d3b0bc71f1ec9 (patch)
tree695f0462fb1fb080417b7e18874986847103a37e /trie/trie.go
parentf7417d3552de86f5acf969b6eb882502fd104a11 (diff)
downloaddexon-3220a32ff056f5bffed031bf1c4d3b0bc71f1ec9.tar
dexon-3220a32ff056f5bffed031bf1c4d3b0bc71f1ec9.tar.gz
dexon-3220a32ff056f5bffed031bf1c4d3b0bc71f1ec9.tar.bz2
dexon-3220a32ff056f5bffed031bf1c4d3b0bc71f1ec9.tar.lz
dexon-3220a32ff056f5bffed031bf1c4d3b0bc71f1ec9.tar.xz
dexon-3220a32ff056f5bffed031bf1c4d3b0bc71f1ec9.tar.zst
dexon-3220a32ff056f5bffed031bf1c4d3b0bc71f1ec9.zip
Added some comparison tests for the new ptrie
Diffstat (limited to 'trie/trie.go')
-rw-r--r--trie/trie.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/trie/trie.go b/trie/trie.go
index 139e3d286..d89c39775 100644
--- a/trie/trie.go
+++ b/trie/trie.go
@@ -197,7 +197,12 @@ func (t *Trie) Update(key, value string) {
k := CompactHexDecode(key)
- root := t.UpdateState(t.Root, k, value)
+ var root interface{}
+ if value != "" {
+ root = t.UpdateState(t.Root, k, value)
+ } else {
+ root = t.deleteState(t.Root, k)
+ }
t.setRoot(root)
}