accounts: remove redundant string conversion (#29184)

This commit is contained in:
Daniel Liu 2025-01-14 10:56:16 +08:00
parent 888963c6ff
commit a9ca99dc6a

View file

@ -208,7 +208,7 @@ func TextHash(data []byte) []byte {
//
// This gives context to the signed message and prevents signing of transactions.
func TextAndHash(data []byte) ([]byte, string) {
msg := fmt.Sprintf("\x19Ethereum Signed Message:\n%d%s", len(data), string(data))
msg := fmt.Sprintf("\x19Ethereum Signed Message:\n%d%s", len(data), data)
hasher := sha3.NewLegacyKeccak256()
hasher.Write([]byte(msg))
return hasher.Sum(nil), msg