Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
20fe9289
Commit
20fe9289
authored
Dec 01, 2017
by
Guillaume Ballet
Committed by
Felix Lange
Dec 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
whisper: rename EnvNonce to Nonce in the v6 Envelope (#15579)
parent
54aeb8e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
envelope.go
whisper/whisperv6/envelope.go
+4
-4
No files found.
whisper/whisperv6/envelope.go
View file @
20fe9289
...
...
@@ -42,7 +42,7 @@ type Envelope struct {
Topic
TopicType
AESNonce
[]
byte
Data
[]
byte
EnvNonce
uint64
Nonce
uint64
pow
float64
// Message-specific PoW as described in the Whisper specification.
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)
Topic
:
topic
,
AESNonce
:
aesNonce
,
Data
:
msg
.
Raw
,
EnvNonce
:
0
,
Nonce
:
0
,
}
if
EnvelopeVersion
<
256
{
...
...
@@ -119,7 +119,7 @@ func (e *Envelope) Seal(options *MessageParams) error {
d
:=
new
(
big
.
Int
)
.
SetBytes
(
crypto
.
Keccak256
(
buf
))
firstBit
:=
math
.
FirstBitSet
(
d
)
if
firstBit
>
bestBit
{
e
.
Env
Nonce
,
bestBit
=
nonce
,
firstBit
e
.
Nonce
,
bestBit
=
nonce
,
firstBit
if
target
>
0
&&
bestBit
>=
target
{
return
nil
}
...
...
@@ -146,7 +146,7 @@ func (e *Envelope) calculatePoW(diff uint32) {
buf
:=
make
([]
byte
,
64
)
h
:=
crypto
.
Keccak256
(
e
.
rlpWithoutNonce
())
copy
(
buf
[
:
32
],
h
)
binary
.
BigEndian
.
PutUint64
(
buf
[
56
:
],
e
.
Env
Nonce
)
binary
.
BigEndian
.
PutUint64
(
buf
[
56
:
],
e
.
Nonce
)
d
:=
new
(
big
.
Int
)
.
SetBytes
(
crypto
.
Keccak256
(
buf
))
firstBit
:=
math
.
FirstBitSet
(
d
)
x
:=
gmath
.
Pow
(
2
,
float64
(
firstBit
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment