whisper: make the header size a constant

This commit is contained in:
Guillaume Ballet 2017-12-01 10:50:09 +01:00 committed by Felix Lange
parent 225967a6e3
commit 736e75697d
2 changed files with 3 additions and 1 deletions

View file

@ -67,6 +67,8 @@ const (
DefaultTTL = 50 // seconds DefaultTTL = 50 // seconds
SynchAllowance = 10 // seconds SynchAllowance = 10 // seconds
EnvelopeHeaderLength = 20
) )
type unknownVersionError uint64 type unknownVersionError uint64

View file

@ -50,7 +50,7 @@ type Envelope struct {
// size returns the size of envelope as it is sent (i.e. public fields only) // size returns the size of envelope as it is sent (i.e. public fields only)
func (e *Envelope) size() int { func (e *Envelope) size() int {
return 20 + len(e.Version) + len(e.Data) return EnvelopeHeaderLength + len(e.Version) + len(e.Data)
} }
// rlpWithoutNonce returns the RLP encoded envelope contents, except the nonce. // rlpWithoutNonce returns the RLP encoded envelope contents, except the nonce.