Skip to content

Commit 20fe928

Browse files
gballetfjl
authored andcommitted
whisper: rename EnvNonce to Nonce in the v6 Envelope (#15579)
1 parent 54aeb8e commit 20fe928

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎whisper/whisperv6/envelope.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type Envelope struct {
4242
Topic TopicType
4343
AESNonce []byte
4444
Data []byte
45-
EnvNonce uint64
45+
Nonce uint64
4646

4747
pow float64 // Message-specific PoW as described in the Whisper specification.
4848
hash common.Hash // Cached hash of the envelope to avoid rehashing every time.
@@ -70,7 +70,7 @@ func NewEnvelope(ttl uint32, topic TopicType, aesNonce []byte, msg *sentMessage)
7070
Topic: topic,
7171
AESNonce: aesNonce,
7272
Data: msg.Raw,
73-
EnvNonce: 0,
73+
Nonce: 0,
7474
}
7575

7676
if EnvelopeVersion < 256 {
@@ -119,7 +119,7 @@ func (e *Envelope) Seal(options *MessageParams) error {
119119
d := new(big.Int).SetBytes(crypto.Keccak256(buf))
120120
firstBit := math.FirstBitSet(d)
121121
if firstBit > bestBit {
122-
e.EnvNonce, bestBit = nonce, firstBit
122+
e.Nonce, bestBit = nonce, firstBit
123123
if target > 0 && bestBit >= target {
124124
return nil
125125
}
@@ -146,7 +146,7 @@ func (e *Envelope) calculatePoW(diff uint32) {
146146
buf := make([]byte, 64)
147147
h := crypto.Keccak256(e.rlpWithoutNonce())
148148
copy(buf[:32], h)
149-
binary.BigEndian.PutUint64(buf[56:], e.EnvNonce)
149+
binary.BigEndian.PutUint64(buf[56:], e.Nonce)
150150
d := new(big.Int).SetBytes(crypto.Keccak256(buf))
151151
firstBit := math.FirstBitSet(d)
152152
x := gmath.Pow(2, float64(firstBit))

0 commit comments

Comments
 (0)