aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-04-14 18:05:36 +0800
committerFelix Lange <fjl@twurst.com>2015-04-17 20:45:09 +0800
commit509d0a8d78236562d9444a6fe851aec3cee5bb5e (patch)
tree9976721cae67adc8b7bd758cb262b2a6f03a007e
parenteedbb1ee9a2164cd58e9fd305bc719a4c643f1a2 (diff)
downloaddexon-509d0a8d78236562d9444a6fe851aec3cee5bb5e.tar
dexon-509d0a8d78236562d9444a6fe851aec3cee5bb5e.tar.gz
dexon-509d0a8d78236562d9444a6fe851aec3cee5bb5e.tar.bz2
dexon-509d0a8d78236562d9444a6fe851aec3cee5bb5e.tar.lz
dexon-509d0a8d78236562d9444a6fe851aec3cee5bb5e.tar.xz
dexon-509d0a8d78236562d9444a6fe851aec3cee5bb5e.tar.zst
dexon-509d0a8d78236562d9444a6fe851aec3cee5bb5e.zip
whisper: fix comment for rlpenv
-rw-r--r--whisper/envelope.go9
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
}