trie: the hex length is even, (even+1)/2 == even/2

This commit is contained in:
Delweng Zheng 2018-05-24 21:21:10 +08:00
parent 0810034311
commit c3c5f335e6

View file

@ -83,7 +83,7 @@ func hexToKeybytes(hex []byte) []byte {
if len(hex)&1 != 0 { if len(hex)&1 != 0 {
panic("can't convert hex key of odd length") panic("can't convert hex key of odd length")
} }
key := make([]byte, (len(hex)+1)/2) key := make([]byte, len(hex)/2)
decodeNibbles(hex, key) decodeNibbles(hex, key)
return key return key
} }