Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
17c825f5
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,发现更多精彩内容 >>
提交
17c825f5
编写于
5月 30, 2014
作者:
O
obscuren
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Peer changes broadcasting and minor miner fix
上级
b15e03ac
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
43 addition
and
14 deletion
+43
-14
ethereum.go
ethereum.go
+1
-0
ethminer/miner.go
ethminer/miner.go
+1
-1
ethutil/config.go
ethutil/config.go
+41
-13
未找到文件。
ethereum.go
浏览文件 @
17c825f5
...
...
@@ -238,6 +238,7 @@ func (s *Ethereum) ConnectToPeer(addr string) error {
s
.
peers
.
PushBack
(
peer
)
ethutil
.
Config
.
Log
.
Infof
(
"[SERV] Adding peer (%s) %d / %d
\n
"
,
addr
,
s
.
peers
.
Len
(),
s
.
MaxPeers
)
s
.
reactor
.
Post
(
"peerList"
,
s
.
peers
)
}
return
nil
...
...
ethminer/miner.go
浏览文件 @
17c825f5
...
...
@@ -149,7 +149,7 @@ func (self *Miner) mineNewBlock() {
// Find a valid nonce
self
.
block
.
Nonce
=
self
.
pow
.
Search
(
self
.
block
,
self
.
powQuitChan
)
if
self
.
block
.
Nonce
!=
nil
{
err
:=
self
.
ethereum
.
StateManager
()
.
Process
(
self
.
block
,
tru
e
)
err
:=
self
.
ethereum
.
StateManager
()
.
Process
(
self
.
block
,
fals
e
)
if
err
!=
nil
{
ethutil
.
Config
.
Log
.
Infoln
(
err
)
}
else
{
...
...
ethutil/config.go
浏览文件 @
17c825f5
...
...
@@ -22,26 +22,54 @@ type config struct {
Identifier
string
}
const
defaultConf
=
`
id = ""
port = 30303
upnp = true
maxpeer = 10
rpc = false
rpcport = 8080
`
var
Config
*
config
func
ApplicationFolder
(
base
string
)
string
{
usr
,
_
:=
user
.
Current
()
p
:=
path
.
Join
(
usr
.
HomeDir
,
base
)
if
len
(
base
)
>
0
{
//Check if the logging directory already exists, create it if not
_
,
err
:=
os
.
Stat
(
p
)
if
err
!=
nil
{
if
os
.
IsNotExist
(
err
)
{
log
.
Printf
(
"Debug logging directory %s doesn't exist, creating it
\n
"
,
p
)
os
.
Mkdir
(
p
,
0777
)
}
}
iniFilePath
:=
path
.
Join
(
p
,
"conf.ini"
)
_
,
err
=
os
.
Stat
(
iniFilePath
)
if
err
!=
nil
&&
os
.
IsNotExist
(
err
)
{
file
,
err
:=
os
.
Create
(
iniFilePath
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
}
else
{
assetPath
:=
path
.
Join
(
os
.
Getenv
(
"GOPATH"
),
"src"
,
"github.com"
,
"ethereum"
,
"go-ethereum"
,
"ethereal"
,
"assets"
)
file
.
Write
([]
byte
(
defaultConf
+
"
\n
asset_path = "
+
assetPath
))
}
}
}
return
p
}
// Read config
//
// Initialize the global Config variable with default settings
func
ReadConfig
(
base
string
,
logTypes
LoggerType
,
id
string
)
*
config
{
if
Config
==
nil
{
usr
,
_
:=
user
.
Current
()
path
:=
path
.
Join
(
usr
.
HomeDir
,
base
)
if
len
(
base
)
>
0
{
//Check if the logging directory already exists, create it if not
_
,
err
:=
os
.
Stat
(
path
)
if
err
!=
nil
{
if
os
.
IsNotExist
(
err
)
{
log
.
Printf
(
"Debug logging directory %s doesn't exist, creating it
\n
"
,
path
)
os
.
Mkdir
(
path
,
0777
)
}
}
}
path
:=
ApplicationFolder
(
base
)
Config
=
&
config
{
ExecPath
:
path
,
Debug
:
true
,
Ver
:
"0.5.0 RC11"
}
Config
.
Identifier
=
id
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录