aboutsummaryrefslogtreecommitdiffstats
path: root/ptrie/iterator.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-11-21 01:11:31 +0800
committerobscuren <geffobscura@gmail.com>2014-11-21 01:11:31 +0800
commit12f1aea38d6f9dd9748a95b2d9ea813ae16277a7 (patch)
treebb979543f80229244e6d3ebf8ef9c21d7b6f1370 /ptrie/iterator.go
parentb05e63c34d335e65c8c76ed9a9401b74170db617 (diff)
downloaddexon-12f1aea38d6f9dd9748a95b2d9ea813ae16277a7.tar
dexon-12f1aea38d6f9dd9748a95b2d9ea813ae16277a7.tar.gz
dexon-12f1aea38d6f9dd9748a95b2d9ea813ae16277a7.tar.bz2
dexon-12f1aea38d6f9dd9748a95b2d9ea813ae16277a7.tar.lz
dexon-12f1aea38d6f9dd9748a95b2d9ea813ae16277a7.tar.xz
dexon-12f1aea38d6f9dd9748a95b2d9ea813ae16277a7.tar.zst
dexon-12f1aea38d6f9dd9748a95b2d9ea813ae16277a7.zip
Fixed iterator for short nodes.
In some cases the iterator didn't properly return the correct key because it didn't append fields to the reverse lookup.
Diffstat (limited to 'ptrie/iterator.go')
-rw-r--r--ptrie/iterator.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/ptrie/iterator.go b/ptrie/iterator.go
index c6d4f64a0..5714bdbc8 100644
--- a/ptrie/iterator.go
+++ b/ptrie/iterator.go
@@ -65,9 +65,9 @@ func (self *Iterator) next(node Node, key []byte) []byte {
}
} else {
cnode := node.Value()
- skey := key[len(k):]
var ret []byte
+ skey := key[len(k):]
if trie.BeginsWith(key, k) {
ret = self.next(cnode, skey)
} else if bytes.Compare(k, key[:len(k)]) > 0 {
@@ -93,7 +93,8 @@ func (self *Iterator) key(node Node) []byte {
return k
} else {
- return self.key(node.Value())
+ k := trie.RemTerm(node.Key())
+ return append(k, self.key(node.Value())...)
}
case *FullNode:
if node.Value() != nil {