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
eea3ae42
Commit
eea3ae42
authored
Nov 07, 2018
by
Martin Holst Swende
Committed by
Péter Szilágyi
Nov 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core, eth/downloader: fix validation flaw, fix downloader printout flaw (#17974)
parent
dc6648bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
block_validator.go
core/block_validator.go
+6
-6
downloader.go
eth/downloader/downloader.go
+1
-0
No files found.
core/block_validator.go
View file @
eea3ae42
...
@@ -53,12 +53,6 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error {
...
@@ -53,12 +53,6 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error {
if
v
.
bc
.
HasBlockAndState
(
block
.
Hash
(),
block
.
NumberU64
())
{
if
v
.
bc
.
HasBlockAndState
(
block
.
Hash
(),
block
.
NumberU64
())
{
return
ErrKnownBlock
return
ErrKnownBlock
}
}
if
!
v
.
bc
.
HasBlockAndState
(
block
.
ParentHash
(),
block
.
NumberU64
()
-
1
)
{
if
!
v
.
bc
.
HasBlock
(
block
.
ParentHash
(),
block
.
NumberU64
()
-
1
)
{
return
consensus
.
ErrUnknownAncestor
}
return
consensus
.
ErrPrunedAncestor
}
// Header validity is known at this point, check the uncles and transactions
// Header validity is known at this point, check the uncles and transactions
header
:=
block
.
Header
()
header
:=
block
.
Header
()
if
err
:=
v
.
engine
.
VerifyUncles
(
v
.
bc
,
block
);
err
!=
nil
{
if
err
:=
v
.
engine
.
VerifyUncles
(
v
.
bc
,
block
);
err
!=
nil
{
...
@@ -70,6 +64,12 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error {
...
@@ -70,6 +64,12 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error {
if
hash
:=
types
.
DeriveSha
(
block
.
Transactions
());
hash
!=
header
.
TxHash
{
if
hash
:=
types
.
DeriveSha
(
block
.
Transactions
());
hash
!=
header
.
TxHash
{
return
fmt
.
Errorf
(
"transaction root hash mismatch: have %x, want %x"
,
hash
,
header
.
TxHash
)
return
fmt
.
Errorf
(
"transaction root hash mismatch: have %x, want %x"
,
hash
,
header
.
TxHash
)
}
}
if
!
v
.
bc
.
HasBlockAndState
(
block
.
ParentHash
(),
block
.
NumberU64
()
-
1
)
{
if
!
v
.
bc
.
HasBlock
(
block
.
ParentHash
(),
block
.
NumberU64
()
-
1
)
{
return
consensus
.
ErrUnknownAncestor
}
return
consensus
.
ErrPrunedAncestor
}
return
nil
return
nil
}
}
...
...
eth/downloader/downloader.go
View file @
eea3ae42
...
@@ -740,6 +740,7 @@ func (d *Downloader) findAncestor(p *peerConnection, height uint64) (uint64, err
...
@@ -740,6 +740,7 @@ func (d *Downloader) findAncestor(p *peerConnection, height uint64) (uint64, err
return
0
,
errBadPeer
return
0
,
errBadPeer
}
}
start
=
check
start
=
check
hash
=
h
case
<-
timeout
:
case
<-
timeout
:
p
.
log
.
Debug
(
"Waiting for search header timed out"
,
"elapsed"
,
ttl
)
p
.
log
.
Debug
(
"Waiting for search header timed out"
,
"elapsed"
,
ttl
)
...
...
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