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
14bef9a2
Unverified
Commit
14bef9a2
authored
Oct 03, 2018
by
Péter Szilágyi
Committed by
GitHub
Oct 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix unnecessary ancestor lookup after a fast sync (#17825)
parent
d3a773c2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
chain_indexer.go
core/chain_indexer.go
+5
-5
No files found.
core/chain_indexer.go
View file @
14bef9a2
...
...
@@ -219,13 +219,13 @@ func (c *ChainIndexer) eventLoop(currentHeader *types.Header, events chan ChainE
}
header
:=
ev
.
Block
.
Header
()
if
header
.
ParentHash
!=
prevHash
{
// Reorg to the common ancestor (might not exist in light sync mode, skip reorg then)
// Reorg to the common ancestor
if needed
(might not exist in light sync mode, skip reorg then)
// TODO(karalabe, zsfelfoldi): This seems a bit brittle, can we detect this case explicitly?
// TODO(karalabe): This operation is expensive and might block, causing the event system to
// potentially also lock up. We need to do with on a different thread somehow.
if
h
:=
rawdb
.
FindCommonAncestor
(
c
.
chainDb
,
prevHeader
,
header
);
h
!=
nil
{
c
.
newHead
(
h
.
Number
.
Uint64
(),
true
)
if
rawdb
.
ReadCanonicalHash
(
c
.
chainDb
,
prevHeader
.
Number
.
Uint64
())
!=
prevHash
{
if
h
:=
rawdb
.
FindCommonAncestor
(
c
.
chainDb
,
prevHeader
,
header
);
h
!=
nil
{
c
.
newHead
(
h
.
Number
.
Uint64
(),
true
)
}
}
}
c
.
newHead
(
header
.
Number
.
Uint64
(),
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