Skip to content

Commit 509d0a8

Browse files
committed
whisper: fix comment for rlpenv
1 parent eedbb1e commit 509d0a8

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎whisper/envelope.go‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,17 @@ func (self *Envelope) Hash() common.Hash {
109109
return self.hash
110110
}
111111

112-
// rlpenv is an Envelope but is not an rlp.Decoder.
113-
// It is used for decoding because we need to
114-
type rlpenv Envelope
115-
116112
// DecodeRLP decodes an Envelope from an RLP data stream.
117113
func (self *Envelope) DecodeRLP(s *rlp.Stream) error {
118114
raw, err := s.Raw()
119115
if err != nil {
120116
return err
121117
}
118+
// The decoding of Envelope uses the struct fields but also needs
119+
// to compute the hash of the whole RLP-encoded envelope. This
120+
// type has the same structure as Envelope but is not an
121+
// rlp.Decoder so we can reuse the Envelope struct definition.
122+
type rlpenv Envelope
122123
if err := rlp.DecodeBytes(raw, (*rlpenv)(self)); err != nil {
123124
return err
124125
}

0 commit comments

Comments
 (0)