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
b9affbf9
Commit
b9affbf9
authored
Jun 10, 2015
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth: discard fetched blocks that don't fit (no goroutine)
parent
858a6f0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
sync.go
eth/sync.go
+13
-13
No files found.
eth/sync.go
View file @
b9affbf9
...
...
@@ -200,23 +200,23 @@ func (pm *ProtocolManager) fetcher() {
case
<-
pm
.
quitSync
:
return
}
// If any explicit fetches were replied to, import them
if
count
:=
len
(
explicit
);
count
>
0
{
glog
.
V
(
logger
.
Debug
)
.
Infof
(
"Importing %d explicitly fetched blocks"
,
count
)
// Create a closure with the retrieved blocks and origin peers
peers
:=
make
([]
*
peer
,
0
,
count
)
blocks
:=
make
([]
*
types
.
Block
,
0
,
count
)
for
_
,
block
:=
range
explicit
{
hash
:=
block
.
Hash
()
if
announce
:=
pending
[
hash
];
announce
!=
nil
{
// Create a closure with the retrieved blocks and origin peers
peers
:=
make
([]
*
peer
,
0
,
len
(
explicit
))
blocks
=
make
([]
*
types
.
Block
,
0
,
len
(
explicit
))
for
_
,
block
:=
range
explicit
{
hash
:=
block
.
Hash
()
if
announce
:=
pending
[
hash
];
announce
!=
nil
{
// Filter out blocks too new to import anyway
if
!
pm
.
chainman
.
HasBlock
(
hash
)
&&
pm
.
chainman
.
HasBlock
(
block
.
ParentHash
())
{
peers
=
append
(
peers
,
announce
.
peer
)
blocks
=
append
(
blocks
,
block
)
delete
(
pending
,
hash
)
}
delete
(
pending
,
hash
)
}
// Run the importer on a new thread
}
// If any explicit fetches were replied to, import them
if
count
:=
len
(
blocks
);
count
>
0
{
glog
.
V
(
logger
.
Debug
)
.
Infof
(
"Importing %d explicitly fetched blocks"
,
len
(
blocks
))
go
func
()
{
for
i
:=
0
;
i
<
len
(
blocks
);
i
++
{
if
err
:=
pm
.
importBlock
(
peers
[
i
],
blocks
[
i
],
nil
);
err
!=
nil
{
...
...
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