aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-03-18 20:17:39 +0800
committerFelix Lange <fjl@twurst.com>2015-03-18 20:17:39 +0800
commitb94a6a0193884ba2edb8eb38670e51b033893387 (patch)
tree32e62cd3dfb2a22ac1994b23b5198c40aa942cc1
parentcb009a5c4da40e1987b9dfcffa4d52bcae41e4e1 (diff)
downloadgo-tangerine-b94a6a0193884ba2edb8eb38670e51b033893387.tar
go-tangerine-b94a6a0193884ba2edb8eb38670e51b033893387.tar.gz
go-tangerine-b94a6a0193884ba2edb8eb38670e51b033893387.tar.bz2
go-tangerine-b94a6a0193884ba2edb8eb38670e51b033893387.tar.lz
go-tangerine-b94a6a0193884ba2edb8eb38670e51b033893387.tar.xz
go-tangerine-b94a6a0193884ba2edb8eb38670e51b033893387.tar.zst
go-tangerine-b94a6a0193884ba2edb8eb38670e51b033893387.zip
rlp: add DecodeBytes
Über-convenience.
-rw-r--r--rlp/decode.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/rlp/decode.go b/rlp/decode.go
index 55f7187a3..6d7e670c2 100644
--- a/rlp/decode.go
+++ b/rlp/decode.go
@@ -2,6 +2,7 @@ package rlp
import (
"bufio"
+ "bytes"
"encoding/binary"
"errors"
"fmt"
@@ -73,6 +74,12 @@ func Decode(r io.Reader, val interface{}) error {
return NewStream(r).Decode(val)
}
+// DecodeBytes parses RLP data from b into val.
+// Please see the documentation of Decode for the decoding rules.
+func DecodeBytes(b []byte, val interface{}) error {
+ return NewStream(bytes.NewReader(b)).Decode(val)
+}
+
type decodeError struct {
msg string
typ reflect.Type