good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
5c53a5be
Commit
5c53a5be
authored
7 years ago
by
mark.lin
Browse files
Options
Downloads
Patches
Plain Diff
consensus/clique: fix typo and don't add snapshot into recents again
parent
431cf2a1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
consensus/clique/clique.go
+7
-8
7 additions, 8 deletions
consensus/clique/clique.go
with
7 additions
and
8 deletions
consensus/clique/clique.go
+
7
−
8
View file @
5c53a5be
...
...
@@ -99,10 +99,10 @@ var (
// their extra-data fields.
errExtraSigners
=
errors
.
New
(
"non-checkpoint block contains extra signer list"
)
//
d
rrInvalidCheckpointSigners is returned if a checkpoint block contains an
//
e
rrInvalidCheckpointSigners is returned if a checkpoint block contains an
// invalid list of signers (i.e. non divisible by 20 bytes, or not the correct
// ones).
d
rrInvalidCheckpointSigners
=
errors
.
New
(
"invalid signer list on checkpoint block"
)
e
rrInvalidCheckpointSigners
=
errors
.
New
(
"invalid signer list on checkpoint block"
)
// errInvalidMixDigest is returned if a block's mix digest is non-zero.
errInvalidMixDigest
=
errors
.
New
(
"non-zero mix digest"
)
...
...
@@ -297,7 +297,7 @@ func (c *Clique) verifyHeader(chain consensus.ChainReader, header *types.Header,
return
errExtraSigners
}
if
checkpoint
&&
signersBytes
%
common
.
AddressLength
!=
0
{
return
d
rrInvalidCheckpointSigners
return
e
rrInvalidCheckpointSigners
}
// Ensure that the mix digest is zero as we don't have fork protection currently
if
header
.
MixDigest
!=
(
common
.
Hash
{})
{
...
...
@@ -353,7 +353,7 @@ func (c *Clique) verifyCascadingFields(chain consensus.ChainReader, header *type
}
extraSuffix
:=
len
(
header
.
Extra
)
-
extraSeal
if
!
bytes
.
Equal
(
header
.
Extra
[
extraVanity
:
extraSuffix
],
signers
)
{
return
d
rrInvalidCheckpointSigners
return
e
rrInvalidCheckpointSigners
}
}
// All basic checks passed, verify the seal and return
...
...
@@ -467,7 +467,6 @@ func (c *Clique) verifySeal(chain consensus.ChainReader, header *types.Header, p
if
err
!=
nil
{
return
err
}
c
.
recents
.
Add
(
snap
.
Hash
,
snap
)
// Resolve the authorization key and check against signers
signer
,
err
:=
ecrecover
(
header
,
c
.
signatures
)
...
...
@@ -479,13 +478,13 @@ func (c *Clique) verifySeal(chain consensus.ChainReader, header *types.Header, p
}
for
seen
,
recent
:=
range
snap
.
Recents
{
if
recent
==
signer
{
// Signer is among recents, only fail if the current block doe
n
s't shift it out
// Signer is among recents, only fail if the current block does
n
't shift it out
if
limit
:=
uint64
(
len
(
snap
.
Signers
)
/
2
+
1
);
seen
>
number
-
limit
{
return
errUnauthorized
}
}
}
// Ensure that the difficulty correspon
t
s to the turn-ness of the signer
// Ensure that the difficulty correspon
d
s to the turn-ness of the signer
inturn
:=
snap
.
inturn
(
header
.
Number
.
Uint64
(),
signer
)
if
inturn
&&
header
.
Difficulty
.
Cmp
(
diffInTurn
)
!=
0
{
return
errInvalidDifficulty
...
...
@@ -604,7 +603,7 @@ func (c *Clique) Seal(chain consensus.ChainReader, block *types.Block, stop <-ch
// If we're amongst the recent signers, wait for the next block
for
seen
,
recent
:=
range
snap
.
Recents
{
if
recent
==
signer
{
// Signer is among recents, only wait if the current block doe
n
s't shift it out
// Signer is among recents, only wait if the current block does
n
't shift it out
if
limit
:=
uint64
(
len
(
snap
.
Signers
)
/
2
+
1
);
number
<
limit
||
seen
>
number
-
limit
{
log
.
Info
(
"Signed recently, must wait for others"
)
<-
stop
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment