mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-21 15:29:27 +00:00
signer/core/apitypes: simplify reflect []byte creation (#32315)
Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
parent
e979438a55
commit
bd6797eafa
1 changed files with 1 additions and 1 deletions
|
|
@ -544,7 +544,7 @@ 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.MakeSlice(reflect.TypeOf([]byte{}), val.Len(), val.Len())
|
v := reflect.ValueOf(make([]byte, val.Len()))
|
||||||
reflect.Copy(v, val)
|
reflect.Copy(v, val)
|
||||||
return v.Bytes(), true
|
return v.Bytes(), true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue