From 4ee67b8d25ee5ea4a329ba5393f679eb4d984fff Mon Sep 17 00:00:00 2001 From: Sahil-4555 Date: Mon, 1 Dec 2025 11:18:50 +0530 Subject: [PATCH] use in built bytes clone method --- common/bytes.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/common/bytes.go b/common/bytes.go index d1f5c6c995..69318328ae 100644 --- a/common/bytes.go +++ b/common/bytes.go @@ -18,6 +18,7 @@ package common import ( + "bytes" "encoding/hex" "errors" @@ -37,14 +38,8 @@ func FromHex(s string) []byte { } // CopyBytes returns an exact copy of the provided bytes. -func CopyBytes(b []byte) (copiedBytes []byte) { - if b == nil { - return nil - } - copiedBytes = make([]byte, len(b)) - copy(copiedBytes, b) - - return +func CopyBytes(b []byte) []byte { + return bytes.Clone(b) } // has0xPrefix validates str begins with '0x' or '0X'.