mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-22 15:59:26 +00:00
trie: avoid unnecessary slicing on shortnode decoding (#16917)
optimization code
This commit is contained in:
parent
feb6620c34
commit
ea06da0892
1 changed files with 3 additions and 4 deletions
|
|
@ -53,10 +53,9 @@ func hexToCompact(hex []byte) []byte {
|
||||||
|
|
||||||
func compactToHex(compact []byte) []byte {
|
func compactToHex(compact []byte) []byte {
|
||||||
base := keybytesToHex(compact)
|
base := keybytesToHex(compact)
|
||||||
base = base[:len(base)-1]
|
// delete terminator flag
|
||||||
// apply terminator flag
|
if base[0] < 2 {
|
||||||
if base[0] >= 2 {
|
base = base[:len(base)-1]
|
||||||
base = append(base, 16)
|
|
||||||
}
|
}
|
||||||
// apply odd flag
|
// apply odd flag
|
||||||
chop := 2 - base[0]&1
|
chop := 2 - base[0]&1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue