diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-19 21:31:14 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-19 21:31:14 +0800 |
commit | cf45b939a098c9421092226d5c76dbce34eb2dda (patch) | |
tree | 2a57c4880feff1f0ff98ec505998dbb1643db1b0 /trie | |
parent | d7ab716eea1d1892e3358b1dece6b0e2cd31fce8 (diff) | |
download | dexon-cf45b939a098c9421092226d5c76dbce34eb2dda.tar.gz dexon-cf45b939a098c9421092226d5c76dbce34eb2dda.tar.zst dexon-cf45b939a098c9421092226d5c76dbce34eb2dda.zip |
fixed tests
Diffstat (limited to 'trie')
-rw-r--r-- | trie/trie.go | 9 |
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 |