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
493100ba
Unverified
Commit
493100ba
authored
Aug 20, 2020
by
Martin Holst Swende
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
consensus/ethash: less lookups of block data
parent
b68929ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
consensus.go
consensus/ethash/consensus.go
+14
-6
No files found.
consensus/ethash/consensus.go
View file @
493100ba
...
...
@@ -204,15 +204,23 @@ func (ethash *Ethash) VerifyUncles(chain consensus.ChainReader, block *types.Blo
number
,
parent
:=
block
.
NumberU64
()
-
1
,
block
.
ParentHash
()
for
i
:=
0
;
i
<
7
;
i
++
{
ancestor
:=
chain
.
GetBlock
(
parent
,
number
)
if
ancestor
==
nil
{
ancestor
Header
:=
chain
.
GetHeader
(
parent
,
number
)
if
ancestor
Header
==
nil
{
break
}
ancestors
[
ancestor
.
Hash
()]
=
ancestor
.
Header
()
for
_
,
uncle
:=
range
ancestor
.
Uncles
()
{
uncles
.
Add
(
uncle
.
Hash
())
ancestors
[
parent
]
=
ancestorHeader
// If the ancestor doesn't have any uncles, we don't have to iterate them
if
ancestorHeader
.
UncleHash
!=
types
.
EmptyUncleHash
{
// Need to add those uncles to the blacklist too
ancestor
:=
chain
.
GetBlock
(
parent
,
number
)
if
ancestor
==
nil
{
break
}
for
_
,
uncle
:=
range
ancestor
.
Uncles
()
{
uncles
.
Add
(
uncle
.
Hash
())
}
}
parent
,
number
=
ancestor
.
ParentHash
()
,
number
-
1
parent
,
number
=
ancestor
Header
.
ParentHash
,
number
-
1
}
ancestors
[
block
.
Hash
()]
=
block
.
Header
()
uncles
.
Add
(
block
.
Hash
())
...
...
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