diff options
author | obscuren <geffobscura@gmail.com> | 2015-04-19 23:07:59 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-04-19 23:07:59 +0800 |
commit | 8eff550e8b9bf121c27a4c2469ec9878d803a60e (patch) | |
tree | ddc62daeec7a44c2baacb986f8c9d76df25a5976 /whisper/envelope.go | |
parent | 4683f9c0a71fd42e749da46ac56c6ba76f379931 (diff) | |
parent | 8f3a7e41deff4084b166aca1337258077bd2a3e6 (diff) | |
download | go-tangerine-8eff550e8b9bf121c27a4c2469ec9878d803a60e.tar go-tangerine-8eff550e8b9bf121c27a4c2469ec9878d803a60e.tar.gz go-tangerine-8eff550e8b9bf121c27a4c2469ec9878d803a60e.tar.bz2 go-tangerine-8eff550e8b9bf121c27a4c2469ec9878d803a60e.tar.lz go-tangerine-8eff550e8b9bf121c27a4c2469ec9878d803a60e.tar.xz go-tangerine-8eff550e8b9bf121c27a4c2469ec9878d803a60e.tar.zst go-tangerine-8eff550e8b9bf121c27a4c2469ec9878d803a60e.zip |
Merge branch 'fjl-rlp-size-validation' into develop
Diffstat (limited to 'whisper/envelope.go')
-rw-r--r-- | whisper/envelope.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/whisper/envelope.go b/whisper/envelope.go index 0a817e26e..07762c300 100644 --- a/whisper/envelope.go +++ b/whisper/envelope.go @@ -109,16 +109,17 @@ func (self *Envelope) Hash() common.Hash { return self.hash } -// rlpenv is an Envelope but is not an rlp.Decoder. -// It is used for decoding because we need to -type rlpenv Envelope - // DecodeRLP decodes an Envelope from an RLP data stream. func (self *Envelope) DecodeRLP(s *rlp.Stream) error { raw, err := s.Raw() if err != nil { return err } + // The decoding of Envelope uses the struct fields but also needs + // to compute the hash of the whole RLP-encoded envelope. This + // type has the same structure as Envelope but is not an + // rlp.Decoder so we can reuse the Envelope struct definition. + type rlpenv Envelope if err := rlp.DecodeBytes(raw, (*rlpenv)(self)); err != nil { return err } |