Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common: remove usage of deprecated function #21610

Merged
merged 3 commits into from
Nov 4, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
common: remove usage of deprecated function
This changes the default behaviour of ToHexArray and with it the behaviour of eth_getProof.
Previously we encoded an empty slice as 0, now the empty slice is encoded as 0x.
  • Loading branch information
MariusVanDerWijden committed Sep 24, 2020
commit 1e498f84364175e0d15cab765c22b263c01eeca9
8 changes: 6 additions & 2 deletions common/bytes.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
// Package common contains various helper functions.
package common

import "encoding/hex"
import (
"encoding/hex"

"github.com/ethereum/go-ethereum/common/hexutil"
)

// ToHex returns the hex representation of b, prefixed with '0x'.
// For empty slices, the return value is "0x0".
Expand All @@ -35,7 +39,7 @@ func ToHex(b []byte) string {
func ToHexArray(b [][]byte) []string {
r := make([]string, len(b))
for i := range b {
r[i] = ToHex(b[i])
r[i] = hexutil.Encode(b[i])
}
return r
}
Expand Down