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
e74bd587
Unverified
Commit
e74bd587
authored
Feb 05, 2021
by
Guillaume Ballet
Committed by
GitHub
Feb 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
consensus: remove seal verification from the consensus engine interface (#22274)
parent
7ed860d4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
4 additions
and
20 deletions
+4
-20
clique.go
consensus/clique/clique.go
+0
-6
consensus.go
consensus/consensus.go
+0
-4
algorithm_test.go
consensus/ethash/algorithm_test.go
+1
-1
consensus.go
consensus/ethash/consensus.go
+1
-7
ethash_test.go
consensus/ethash/ethash_test.go
+2
-2
No files found.
consensus/clique/clique.go
View file @
e74bd587
...
...
@@ -434,12 +434,6 @@ func (c *Clique) VerifyUncles(chain consensus.ChainReader, block *types.Block) e
return
nil
}
// VerifySeal implements consensus.Engine, checking whether the signature contained
// in the header satisfies the consensus protocol requirements.
func
(
c
*
Clique
)
VerifySeal
(
chain
consensus
.
ChainHeaderReader
,
header
*
types
.
Header
)
error
{
return
c
.
verifySeal
(
chain
,
header
,
nil
)
}
// verifySeal checks whether the signature contained in the header satisfies the
// consensus protocol requirements. The method accepts an optional list of parent
// headers that aren't yet part of the local blockchain to generate the snapshots
...
...
consensus/consensus.go
View file @
e74bd587
...
...
@@ -77,10 +77,6 @@ type Engine interface {
// rules of a given engine.
VerifyUncles
(
chain
ChainReader
,
block
*
types
.
Block
)
error
// VerifySeal checks whether the crypto seal on a header is valid according to
// the consensus rules of the given engine.
VerifySeal
(
chain
ChainHeaderReader
,
header
*
types
.
Header
)
error
// Prepare initializes the consensus fields of a block header according to the
// rules of a particular engine. The changes are executed inline.
Prepare
(
chain
ChainHeaderReader
,
header
*
types
.
Header
)
error
...
...
consensus/ethash/algorithm_test.go
View file @
e74bd587
...
...
@@ -731,7 +731,7 @@ func TestConcurrentDiskCacheGeneration(t *testing.T) {
defer
pend
.
Done
()
ethash
:=
New
(
Config
{
cachedir
,
0
,
1
,
false
,
""
,
0
,
0
,
false
,
ModeNormal
,
nil
},
nil
,
false
)
defer
ethash
.
Close
()
if
err
:=
ethash
.
VerifySeal
(
nil
,
block
.
Header
()
);
err
!=
nil
{
if
err
:=
ethash
.
verifySeal
(
nil
,
block
.
Header
(),
false
);
err
!=
nil
{
t
.
Errorf
(
"proc %d: block verification failed: %v"
,
idx
,
err
)
}
}(
i
)
...
...
consensus/ethash/consensus.go
View file @
e74bd587
...
...
@@ -288,7 +288,7 @@ func (ethash *Ethash) verifyHeader(chain consensus.ChainHeaderReader, header, pa
}
// Verify the engine specific seal securing the block
if
seal
{
if
err
:=
ethash
.
VerifySeal
(
chain
,
header
);
err
!=
nil
{
if
err
:=
ethash
.
verifySeal
(
chain
,
header
,
false
);
err
!=
nil
{
return
err
}
}
...
...
@@ -488,12 +488,6 @@ var FrontierDifficultyCalulator = calcDifficultyFrontier
var
HomesteadDifficultyCalulator
=
calcDifficultyHomestead
var
DynamicDifficultyCalculator
=
makeDifficultyCalculator
// VerifySeal implements consensus.Engine, checking whether the given block satisfies
// the PoW difficulty requirements.
func
(
ethash
*
Ethash
)
VerifySeal
(
chain
consensus
.
ChainHeaderReader
,
header
*
types
.
Header
)
error
{
return
ethash
.
verifySeal
(
chain
,
header
,
false
)
}
// verifySeal checks whether a block satisfies the PoW difficulty requirements,
// either using the usual ethash cache for it, or alternatively using a full DAG
// to make remote mining fast.
...
...
consensus/ethash/ethash_test.go
View file @
e74bd587
...
...
@@ -46,7 +46,7 @@ func TestTestMode(t *testing.T) {
case
block
:=
<-
results
:
header
.
Nonce
=
types
.
EncodeNonce
(
block
.
Nonce
())
header
.
MixDigest
=
block
.
MixDigest
()
if
err
:=
ethash
.
VerifySeal
(
nil
,
header
);
err
!=
nil
{
if
err
:=
ethash
.
verifySeal
(
nil
,
header
,
false
);
err
!=
nil
{
t
.
Fatalf
(
"unexpected verification error: %v"
,
err
)
}
case
<-
time
.
NewTimer
(
4
*
time
.
Second
)
.
C
:
...
...
@@ -86,7 +86,7 @@ func verifyTest(wg *sync.WaitGroup, e *Ethash, workerIndex, epochs int) {
block
=
0
}
header
:=
&
types
.
Header
{
Number
:
big
.
NewInt
(
block
),
Difficulty
:
big
.
NewInt
(
100
)}
e
.
VerifySeal
(
nil
,
header
)
e
.
verifySeal
(
nil
,
header
,
false
)
}
}
...
...
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