accounts: remove redundant string conversion (#29184)

pull/29197/head
cuinix 8 months ago committed by GitHub
parent aadcb88675
commit 3bebabbd03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      accounts/accounts.go

@ -195,7 +195,7 @@ func TextHash(data []byte) []byte {
// //
// This gives context to the signed message and prevents signing of transactions. // This gives context to the signed message and prevents signing of transactions.
func TextAndHash(data []byte) ([]byte, string) { 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 := sha3.NewLegacyKeccak256()
hasher.Write([]byte(msg)) hasher.Write([]byte(msg))
return hasher.Sum(nil), msg return hasher.Sum(nil), msg

Loading…
Cancel
Save