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
0c998684
Unverified
Commit
0c998684
authored
4 years ago
by
Martin Holst Swende
Committed by
GitHub
4 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/devp2p, eth/protocols/eth: fix tests + make sanity checks earlier (#22749)
parent
d9c9ee5a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
8 deletions
+16
-8
eth66_suite.go
cmd/devp2p/internal/ethtest/eth66_suite.go
+2
-2
large.go
cmd/devp2p/internal/ethtest/large.go
+1
-1
suite_test.go
cmd/devp2p/internal/ethtest/suite_test.go
+10
-2
handlers.go
eth/protocols/eth/handlers.go
+3
-3
No files found.
cmd/devp2p/internal/ethtest/eth66_suite.go
View file @
0c998684
...
...
@@ -483,8 +483,8 @@ func (s *Suite) TestNewPooledTxs_66(t *utesting.T) {
t
.
Fatalf
(
"unexpected number of txs requested: wanted %d, got %d"
,
len
(
hashes
),
len
(
msg
))
}
return
case
*
NewPooledTransactionHashes
:
// ignore propagated txs from old tests
case
*
NewPooledTransactionHashes
,
*
NewBlock
,
*
NewBlockHashes
:
// ignore propagated txs
and blocks
from old tests
continue
default
:
t
.
Fatalf
(
"unexpected %s"
,
pretty
.
Sdump
(
msg
))
...
...
This diff is collapsed.
Click to expand it.
cmd/devp2p/internal/ethtest/large.go
View file @
0c998684
...
...
@@ -70,7 +70,7 @@ func largeHeader() *types.Header {
GasUsed
:
0
,
Coinbase
:
common
.
Address
{},
GasLimit
:
0
,
UncleHash
:
randHash
()
,
UncleHash
:
types
.
EmptyUncleHash
,
Time
:
1337
,
ParentHash
:
randHash
(),
Root
:
randHash
(),
...
...
This diff is collapsed.
Click to expand it.
cmd/devp2p/internal/ethtest/suite_test.go
View file @
0c998684
...
...
@@ -19,6 +19,7 @@ package ethtest
import
(
"os"
"testing"
"time"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth/ethconfig"
...
...
@@ -87,8 +88,15 @@ func setupGeth(stack *node.Node) error {
}
backend
,
err
:=
eth
.
New
(
stack
,
&
ethconfig
.
Config
{
Genesis
:
&
chain
.
genesis
,
NetworkId
:
chain
.
genesis
.
Config
.
ChainID
.
Uint64
(),
// 19763
Genesis
:
&
chain
.
genesis
,
NetworkId
:
chain
.
genesis
.
Config
.
ChainID
.
Uint64
(),
// 19763
DatabaseCache
:
10
,
TrieCleanCache
:
10
,
TrieCleanCacheJournal
:
""
,
TrieCleanCacheRejournal
:
60
*
time
.
Minute
,
TrieDirtyCache
:
16
,
TrieTimeout
:
60
*
time
.
Minute
,
SnapshotCache
:
10
,
})
if
err
!=
nil
{
return
err
...
...
This diff is collapsed.
Click to expand it.
eth/protocols/eth/handlers.go
View file @
0c998684
...
...
@@ -292,6 +292,9 @@ func handleNewBlock(backend Backend, msg Decoder, peer *Peer) error {
if
err
:=
msg
.
Decode
(
ann
);
err
!=
nil
{
return
fmt
.
Errorf
(
"%w: message %v: %v"
,
errDecode
,
msg
,
err
)
}
if
err
:=
ann
.
sanityCheck
();
err
!=
nil
{
return
err
}
if
hash
:=
types
.
CalcUncleHash
(
ann
.
Block
.
Uncles
());
hash
!=
ann
.
Block
.
UncleHash
()
{
log
.
Warn
(
"Propagated block has invalid uncles"
,
"have"
,
hash
,
"exp"
,
ann
.
Block
.
UncleHash
())
return
nil
// TODO(karalabe): return error eventually, but wait a few releases
...
...
@@ -300,9 +303,6 @@ func handleNewBlock(backend Backend, msg Decoder, peer *Peer) error {
log
.
Warn
(
"Propagated block has invalid body"
,
"have"
,
hash
,
"exp"
,
ann
.
Block
.
TxHash
())
return
nil
// TODO(karalabe): return error eventually, but wait a few releases
}
if
err
:=
ann
.
sanityCheck
();
err
!=
nil
{
return
err
}
ann
.
Block
.
ReceivedAt
=
msg
.
Time
()
ann
.
Block
.
ReceivedFrom
=
peer
...
...
This diff is collapsed.
Click to expand it.
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