Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
0c998684
G
go-ethereum
项目概览
whqwjb
/
go-ethereum
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
go-ethereum
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
0c998684
编写于
4月 28, 2021
作者:
M
Martin Holst Swende
提交者:
GitHub
4月 28, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cmd/devp2p, eth/protocols/eth: fix tests + make sanity checks earlier (#22749)
上级
d9c9ee5a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
8 deletion
+16
-8
cmd/devp2p/internal/ethtest/eth66_suite.go
cmd/devp2p/internal/ethtest/eth66_suite.go
+2
-2
cmd/devp2p/internal/ethtest/large.go
cmd/devp2p/internal/ethtest/large.go
+1
-1
cmd/devp2p/internal/ethtest/suite_test.go
cmd/devp2p/internal/ethtest/suite_test.go
+10
-2
eth/protocols/eth/handlers.go
eth/protocols/eth/handlers.go
+3
-3
未找到文件。
cmd/devp2p/internal/ethtest/eth66_suite.go
浏览文件 @
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
))
...
...
cmd/devp2p/internal/ethtest/large.go
浏览文件 @
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
(),
...
...
cmd/devp2p/internal/ethtest/suite_test.go
浏览文件 @
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
...
...
eth/protocols/eth/handlers.go
浏览文件 @
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
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录