mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
signer: optimize parseBytes
This commit is contained in:
parent
342285b139
commit
273b8c0eee
1 changed files with 3 additions and 3 deletions
|
|
@ -547,9 +547,9 @@ func parseBytes(encType interface{}) ([]byte, bool) {
|
||||||
// Handle array types.
|
// Handle array types.
|
||||||
val := reflect.ValueOf(encType)
|
val := reflect.ValueOf(encType)
|
||||||
if val.Kind() == reflect.Array && val.Type().Elem().Kind() == reflect.Uint8 {
|
if val.Kind() == reflect.Array && val.Type().Elem().Kind() == reflect.Uint8 {
|
||||||
v := reflect.ValueOf(make([]byte, val.Len()))
|
newV := reflect.New(val.Type()).Elem()
|
||||||
reflect.Copy(v, val)
|
newV.Set(val)
|
||||||
return v.Bytes(), true
|
return newV.Bytes(), true
|
||||||
}
|
}
|
||||||
|
|
||||||
switch v := encType.(type) {
|
switch v := encType.(type) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue