aboutsummaryrefslogtreecommitdiffstats
path: root/rlp/decode.go
diff options
context:
space:
mode:
Diffstat (limited to 'rlp/decode.go')
-rw-r--r--rlp/decode.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/rlp/decode.go b/rlp/decode.go
index 1381f5274..c4d42c6fc 100644
--- a/rlp/decode.go
+++ b/rlp/decode.go
@@ -173,6 +173,8 @@ var (
func makeDecoder(typ reflect.Type, tags tags) (dec decoder, err error) {
kind := typ.Kind()
switch {
+ case typ == rawValueType:
+ return decodeRawValue, nil
case typ.Implements(decoderInterface):
return decodeDecoder, nil
case kind != reflect.Ptr && reflect.PtrTo(typ).Implements(decoderInterface):
@@ -203,6 +205,15 @@ func makeDecoder(typ reflect.Type, tags tags) (dec decoder, err error) {
}
}
+func decodeRawValue(s *Stream, val reflect.Value) error {
+ r, err := s.Raw()
+ if err != nil {
+ return err
+ }
+ val.SetBytes(r)
+ return nil
+}
+
func decodeUint(s *Stream, val reflect.Value) error {
typ := val.Type()
num, err := s.uint(typ.Bits())