mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 15:47:21 +00:00
rlp: use reflect.TypeFor (#32317)
Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
parent
bd6797eafa
commit
4e7bc2bdc8
3 changed files with 6 additions and 6 deletions
|
|
@ -148,9 +148,9 @@ func addErrorContext(err error, ctx string) error {
|
|||
}
|
||||
|
||||
var (
|
||||
decoderInterface = reflect.TypeOf(new(Decoder)).Elem()
|
||||
bigInt = reflect.TypeOf(big.Int{})
|
||||
u256Int = reflect.TypeOf(uint256.Int{})
|
||||
decoderInterface = reflect.TypeFor[Decoder]()
|
||||
bigInt = reflect.TypeFor[big.Int]()
|
||||
u256Int = reflect.TypeFor[uint256.Int]()
|
||||
)
|
||||
|
||||
func makeDecoder(typ reflect.Type, tags rlpstruct.Tags) (dec decoder, err error) {
|
||||
|
|
@ -512,7 +512,7 @@ func makeNilPtrDecoder(etype reflect.Type, etypeinfo *typeinfo, ts rlpstruct.Tag
|
|||
}
|
||||
}
|
||||
|
||||
var ifsliceType = reflect.TypeOf([]interface{}{})
|
||||
var ifsliceType = reflect.TypeFor[[]any]()
|
||||
|
||||
func decodeInterface(s *Stream, val reflect.Value) error {
|
||||
if val.Type().NumMethod() != 0 {
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ func puthead(buf []byte, smalltag, largetag byte, size uint64) int {
|
|||
return sizesize + 1
|
||||
}
|
||||
|
||||
var encoderInterface = reflect.TypeOf(new(Encoder)).Elem()
|
||||
var encoderInterface = reflect.TypeFor[Encoder]()
|
||||
|
||||
// makeWriter creates a writer function for the given type.
|
||||
func makeWriter(typ reflect.Type, ts rlpstruct.Tags) (writer, error) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import (
|
|||
// not verify whether the content of RawValues is valid RLP.
|
||||
type RawValue []byte
|
||||
|
||||
var rawValueType = reflect.TypeOf(RawValue{})
|
||||
var rawValueType = reflect.TypeFor[RawValue]()
|
||||
|
||||
// StringSize returns the encoded size of a string.
|
||||
func StringSize(s string) uint64 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue