Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
8f06b798
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,发现更多精彩内容 >>
提交
8f06b798
编写于
8月 06, 2017
作者:
E
Egon Elbre
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
eth: fix megacheck warnings
上级
97107982
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
17 addition
and
40 deletion
+17
-40
eth/api.go
eth/api.go
+0
-20
eth/downloader/downloader_test.go
eth/downloader/downloader_test.go
+9
-10
eth/filters/api.go
eth/filters/api.go
+0
-1
eth/filters/filter.go
eth/filters/filter.go
+0
-3
eth/filters/filter_system.go
eth/filters/filter_system.go
+0
-1
eth/filters/filter_system_test.go
eth/filters/filter_system_test.go
+4
-3
eth/sync.go
eth/sync.go
+4
-2
未找到文件。
eth/api.go
浏览文件 @
8f06b798
...
...
@@ -465,26 +465,6 @@ func (api *PrivateDebugAPI) traceBlock(block *types.Block, logConfig *vm.LogConf
return
true
,
structLogger
.
StructLogs
(),
nil
}
// callmsg is the message type used for call transitions.
type
callmsg
struct
{
addr
common
.
Address
to
*
common
.
Address
gas
,
gasPrice
*
big
.
Int
value
*
big
.
Int
data
[]
byte
}
// accessor boilerplate to implement core.Message
func
(
m
callmsg
)
From
()
(
common
.
Address
,
error
)
{
return
m
.
addr
,
nil
}
func
(
m
callmsg
)
FromFrontier
()
(
common
.
Address
,
error
)
{
return
m
.
addr
,
nil
}
func
(
m
callmsg
)
Nonce
()
uint64
{
return
0
}
func
(
m
callmsg
)
CheckNonce
()
bool
{
return
false
}
func
(
m
callmsg
)
To
()
*
common
.
Address
{
return
m
.
to
}
func
(
m
callmsg
)
GasPrice
()
*
big
.
Int
{
return
m
.
gasPrice
}
func
(
m
callmsg
)
Gas
()
*
big
.
Int
{
return
m
.
gas
}
func
(
m
callmsg
)
Value
()
*
big
.
Int
{
return
m
.
value
}
func
(
m
callmsg
)
Data
()
[]
byte
{
return
m
.
data
}
// formatError formats a Go error into either an empty string or the data content
// of the error itself.
func
formatError
(
err
error
)
string
{
...
...
eth/downloader/downloader_test.go
浏览文件 @
8f06b798
...
...
@@ -403,8 +403,7 @@ func (dl *downloadTester) newSlowPeer(id string, version int, hashes []common.Ha
dl
.
lock
.
Lock
()
defer
dl
.
lock
.
Unlock
()
var
err
error
err
=
dl
.
downloader
.
RegisterPeer
(
id
,
version
,
&
downloadTesterPeer
{
dl
,
id
,
delay
})
var
err
=
dl
.
downloader
.
RegisterPeer
(
id
,
version
,
&
downloadTesterPeer
{
dl
,
id
,
delay
})
if
err
==
nil
{
// Assign the owned hashes, headers and blocks to the peer (deep copy)
dl
.
peerHashes
[
id
]
=
make
([]
common
.
Hash
,
len
(
hashes
))
...
...
@@ -1381,7 +1380,7 @@ func testSyncProgress(t *testing.T, protocol int, mode SyncMode) {
go
func
()
{
defer
pending
.
Done
()
if
err
:=
tester
.
sync
(
"peer-half"
,
nil
,
mode
);
err
!=
nil
{
t
.
Fatalf
(
"failed to synchronise blocks: %v"
,
err
)
panic
(
fmt
.
Sprintf
(
"failed to synchronise blocks: %v"
,
err
)
)
}
}()
<-
starting
...
...
@@ -1398,7 +1397,7 @@ func testSyncProgress(t *testing.T, protocol int, mode SyncMode) {
go
func
()
{
defer
pending
.
Done
()
if
err
:=
tester
.
sync
(
"peer-full"
,
nil
,
mode
);
err
!=
nil
{
t
.
Fatalf
(
"failed to synchronise blocks: %v"
,
err
)
panic
(
fmt
.
Sprintf
(
"failed to synchronise blocks: %v"
,
err
)
)
}
}()
<-
starting
...
...
@@ -1454,7 +1453,7 @@ func testForkedSyncProgress(t *testing.T, protocol int, mode SyncMode) {
go
func
()
{
defer
pending
.
Done
()
if
err
:=
tester
.
sync
(
"fork A"
,
nil
,
mode
);
err
!=
nil
{
t
.
Fatalf
(
"failed to synchronise blocks: %v"
,
err
)
panic
(
fmt
.
Sprintf
(
"failed to synchronise blocks: %v"
,
err
)
)
}
}()
<-
starting
...
...
@@ -1474,7 +1473,7 @@ func testForkedSyncProgress(t *testing.T, protocol int, mode SyncMode) {
go
func
()
{
defer
pending
.
Done
()
if
err
:=
tester
.
sync
(
"fork B"
,
nil
,
mode
);
err
!=
nil
{
t
.
Fatalf
(
"failed to synchronise blocks: %v"
,
err
)
panic
(
fmt
.
Sprintf
(
"failed to synchronise blocks: %v"
,
err
)
)
}
}()
<-
starting
...
...
@@ -1535,7 +1534,7 @@ func testFailedSyncProgress(t *testing.T, protocol int, mode SyncMode) {
go
func
()
{
defer
pending
.
Done
()
if
err
:=
tester
.
sync
(
"faulty"
,
nil
,
mode
);
err
==
nil
{
t
.
Fatalf
(
"succeeded faulty synchronisation"
)
panic
(
"succeeded faulty synchronisation"
)
}
}()
<-
starting
...
...
@@ -1552,7 +1551,7 @@ func testFailedSyncProgress(t *testing.T, protocol int, mode SyncMode) {
go
func
()
{
defer
pending
.
Done
()
if
err
:=
tester
.
sync
(
"valid"
,
nil
,
mode
);
err
!=
nil
{
t
.
Fatalf
(
"failed to synchronise blocks: %v"
,
err
)
panic
(
fmt
.
Sprintf
(
"failed to synchronise blocks: %v"
,
err
)
)
}
}()
<-
starting
...
...
@@ -1613,7 +1612,7 @@ func testFakedSyncProgress(t *testing.T, protocol int, mode SyncMode) {
go
func
()
{
defer
pending
.
Done
()
if
err
:=
tester
.
sync
(
"attack"
,
nil
,
mode
);
err
==
nil
{
t
.
Fatalf
(
"succeeded attacker synchronisation"
)
panic
(
"succeeded attacker synchronisation"
)
}
}()
<-
starting
...
...
@@ -1630,7 +1629,7 @@ func testFakedSyncProgress(t *testing.T, protocol int, mode SyncMode) {
go
func
()
{
defer
pending
.
Done
()
if
err
:=
tester
.
sync
(
"valid"
,
nil
,
mode
);
err
!=
nil
{
t
.
Fatalf
(
"failed to synchronise blocks: %v"
,
err
)
panic
(
fmt
.
Sprintf
(
"failed to synchronise blocks: %v"
,
err
)
)
}
}()
<-
starting
...
...
eth/filters/api.go
浏览文件 @
8f06b798
...
...
@@ -54,7 +54,6 @@ type PublicFilterAPI struct {
backend
Backend
useMipMap
bool
mux
*
event
.
TypeMux
quit
chan
struct
{}
chainDb
ethdb
.
Database
events
*
EventSystem
filtersMu
sync
.
Mutex
...
...
eth/filters/filter.go
浏览文件 @
8f06b798
...
...
@@ -20,7 +20,6 @@ import (
"context"
"math"
"math/big"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
...
...
@@ -42,8 +41,6 @@ type Filter struct {
backend
Backend
useMipMap
bool
created
time
.
Time
db
ethdb
.
Database
begin
,
end
int64
addresses
[]
common
.
Address
...
...
eth/filters/filter_system.go
浏览文件 @
8f06b798
...
...
@@ -74,7 +74,6 @@ type subscription struct {
// subscription which match the subscription criteria.
type
EventSystem
struct
{
mux
*
event
.
TypeMux
sub
*
event
.
TypeMuxSubscription
backend
Backend
lightMode
bool
lastHead
*
types
.
Header
...
...
eth/filters/filter_system_test.go
浏览文件 @
8f06b798
...
...
@@ -18,6 +18,7 @@ package filters
import
(
"context"
"fmt"
"math/big"
"reflect"
"testing"
...
...
@@ -439,15 +440,15 @@ func TestPendingLogsSubscription(t *testing.T) {
}
if
len
(
fetched
)
!=
len
(
tt
.
expected
)
{
t
.
Fatalf
(
"invalid number of logs for case %d, want %d log(s), got %d"
,
i
,
len
(
tt
.
expected
),
len
(
fetched
))
panic
(
fmt
.
Sprintf
(
"invalid number of logs for case %d, want %d log(s), got %d"
,
i
,
len
(
tt
.
expected
),
len
(
fetched
)
))
}
for
l
:=
range
fetched
{
if
fetched
[
l
]
.
Removed
{
t
.
Errorf
(
"expected log not to be removed for log %d in case %d"
,
l
,
i
)
panic
(
fmt
.
Sprintf
(
"expected log not to be removed for log %d in case %d"
,
l
,
i
)
)
}
if
!
reflect
.
DeepEqual
(
fetched
[
l
],
tt
.
expected
[
l
])
{
t
.
Errorf
(
"invalid log on index %d for case %d"
,
l
,
i
)
panic
(
fmt
.
Sprintf
(
"invalid log on index %d for case %d"
,
l
,
i
)
)
}
}
}()
...
...
eth/sync.go
浏览文件 @
8f06b798
...
...
@@ -138,7 +138,9 @@ func (pm *ProtocolManager) syncer() {
defer
pm
.
downloader
.
Terminate
()
// Wait for different events to fire synchronisation operations
forceSync
:=
time
.
Tick
(
forceSyncCycle
)
forceSync
:=
time
.
NewTicker
(
forceSyncCycle
)
defer
forceSync
.
Stop
()
for
{
select
{
case
<-
pm
.
newPeerCh
:
...
...
@@ -148,7 +150,7 @@ func (pm *ProtocolManager) syncer() {
}
go
pm
.
synchronise
(
pm
.
peers
.
BestPeer
())
case
<-
forceSync
:
case
<-
forceSync
.
C
:
// Force a sync even if not enough peers are present
go
pm
.
synchronise
(
pm
.
peers
.
BestPeer
())
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录