From 404c234c473e0f0c2ffe2e7d85649d675af9b1b8 Mon Sep 17 00:00:00 2001 From: cuinix <915115094@qq.com> Date: Thu, 7 Mar 2024 10:56:43 +0800 Subject: [PATCH] account: remove redundant string conversion when using %s to format []byte to save unnecessary overhead Signed-off-by: cuinix <915115094@qq.com> --- accounts/accounts.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accounts/accounts.go b/accounts/accounts.go index 6c351a9649..b995498a6d 100644 --- a/accounts/accounts.go +++ b/accounts/accounts.go @@ -195,7 +195,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