aboutsummaryrefslogtreecommitdiffstats
path: root/rlp/encode.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-09-09 09:34:15 +0800
committerFelix Lange <fjl@twurst.com>2015-09-11 01:41:51 +0800
commit24bb68e7cf546153436f1d38a7227fdf75d73343 (patch)
treefa85e497a639af7aa8ad1cc83dc09fe104fbd7df /rlp/encode.go
parentbc17dba8fba0f3007398f231f07916a95ed963ac (diff)
downloadgo-tangerine-24bb68e7cf546153436f1d38a7227fdf75d73343.tar
go-tangerine-24bb68e7cf546153436f1d38a7227fdf75d73343.tar.gz
go-tangerine-24bb68e7cf546153436f1d38a7227fdf75d73343.tar.bz2
go-tangerine-24bb68e7cf546153436f1d38a7227fdf75d73343.tar.lz
go-tangerine-24bb68e7cf546153436f1d38a7227fdf75d73343.tar.xz
go-tangerine-24bb68e7cf546153436f1d38a7227fdf75d73343.tar.zst
go-tangerine-24bb68e7cf546153436f1d38a7227fdf75d73343.zip
rlp: add RawValue
Diffstat (limited to 'rlp/encode.go')
-rw-r--r--rlp/encode.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/rlp/encode.go b/rlp/encode.go
index a0531af01..2aeee4721 100644
--- a/rlp/encode.go
+++ b/rlp/encode.go
@@ -354,6 +354,8 @@ var (
func makeWriter(typ reflect.Type) (writer, error) {
kind := typ.Kind()
switch {
+ case typ == rawValueType:
+ return writeRawValue, nil
case typ.Implements(encoderInterface):
return writeEncoder, nil
case kind != reflect.Ptr && reflect.PtrTo(typ).Implements(encoderInterface):
@@ -389,6 +391,11 @@ func isByte(typ reflect.Type) bool {
return typ.Kind() == reflect.Uint8 && !typ.Implements(encoderInterface)
}
+func writeRawValue(val reflect.Value, w *encbuf) error {
+ w.str = append(w.str, val.Bytes()...)
+ return nil
+}
+
func writeUint(val reflect.Value, w *encbuf) error {
i := val.Uint()
if i == 0 {