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
51df1c1f
Commit
51df1c1f
authored
Jul 04, 2018
by
Felföldi Zsolt
Committed by
Péter Szilágyi
Jul 04, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
les: add announcement safety check to light fetcher (#17034)
parent
f524ec43
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
fetcher.go
les/fetcher.go
+9
-2
No files found.
les/fetcher.go
View file @
51df1c1f
...
...
@@ -267,9 +267,16 @@ func (f *lightFetcher) announce(p *peer, head *announceData) {
}
n
=
n
.
parent
}
// n is now the reorg common ancestor, add a new branch of nodes
if
n
!=
nil
&&
(
head
.
Number
>=
n
.
number
+
maxNodeCount
||
head
.
Number
<=
n
.
number
)
{
// if announced head block height is lower or same as n or too far from it to add
// intermediate nodes then discard previous announcement info and trigger a resync
n
=
nil
fp
.
nodeCnt
=
0
fp
.
nodeByHash
=
make
(
map
[
common
.
Hash
]
*
fetcherTreeNode
)
}
if
n
!=
nil
{
// n is now the reorg common ancestor, add a new branch of nodes
// check if the node count is too high to add new nodes
// check if the node count is too high to add new nodes, discard oldest ones if necessary
locked
:=
false
for
uint64
(
fp
.
nodeCnt
)
+
head
.
Number
-
n
.
number
>
maxNodeCount
&&
fp
.
root
!=
nil
{
if
!
locked
{
...
...
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