Skip to content

Commit 02cade4

Browse files
author
Sarlor
authored
Update encoding.go
optimization code
1 parent 90b2277 commit 02cade4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

trie/encoding.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,9 @@ func hexToCompact(hex []byte) []byte {
5353

5454
func compactToHex(compact []byte) []byte {
5555
base := keybytesToHex(compact)
56-
base = base[:len(base)-1]
57-
// apply terminator flag
58-
if base[0] >= 2 {
59-
base = append(base, 16)
56+
// delete terminator flag
57+
if base[0] < 2 {
58+
base = base[:len(base)-1]
6059
}
6160
// apply odd flag
6261
chop := 2 - base[0]&1

0 commit comments

Comments
 (0)