aboutsummaryrefslogtreecommitdiffstats
path: root/trie
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-19 21:31:14 +0800
committerobscuren <geffobscura@gmail.com>2015-03-19 21:31:14 +0800
commitcf45b939a098c9421092226d5c76dbce34eb2dda (patch)
tree2a57c4880feff1f0ff98ec505998dbb1643db1b0 /trie
parentd7ab716eea1d1892e3358b1dece6b0e2cd31fce8 (diff)
downloadgo-tangerine-cf45b939a098c9421092226d5c76dbce34eb2dda.tar
go-tangerine-cf45b939a098c9421092226d5c76dbce34eb2dda.tar.gz
go-tangerine-cf45b939a098c9421092226d5c76dbce34eb2dda.tar.bz2
go-tangerine-cf45b939a098c9421092226d5c76dbce34eb2dda.tar.lz
go-tangerine-cf45b939a098c9421092226d5c76dbce34eb2dda.tar.xz
go-tangerine-cf45b939a098c9421092226d5c76dbce34eb2dda.tar.zst
go-tangerine-cf45b939a098c9421092226d5c76dbce34eb2dda.zip
fixed tests
Diffstat (limited to 'trie')
-rw-r--r--trie/trie.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/trie/trie.go b/trie/trie.go
index 4f47151a4..d990338ee 100644
--- a/trie/trie.go
+++ b/trie/trie.go
@@ -302,12 +302,17 @@ func (self *Trie) mknode(value *common.Value) Node {
case 2:
// A value node may consists of 2 bytes.
if value.Get(0).Len() != 0 {
- return NewShortNode(self, CompactDecode(string(value.Get(0).Bytes())), self.mknode(value.Get(1)))
+ key := CompactDecode(string(value.Get(0).Bytes()))
+ if key[len(key)-1] == 16 {
+ return NewShortNode(self, key, &ValueNode{self, value.Get(1).Bytes()})
+ } else {
+ return NewShortNode(self, key, self.mknode(value.Get(1)))
+ }
}
case 17:
if len(value.Bytes()) != 17 {
fnode := NewFullNode(self)
- for i := 0; i < l; i++ {
+ for i := 0; i < 16; i++ {
fnode.set(byte(i), self.mknode(value.Get(i)))
}
return fnode