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
17c825f5
Commit
17c825f5
authored
May 30, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Peer changes broadcasting and minor miner fix
parent
b15e03ac
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
14 deletions
+43
-14
ethereum.go
ethereum.go
+1
-0
miner.go
ethminer/miner.go
+1
-1
config.go
ethutil/config.go
+41
-13
No files found.
ethereum.go
View file @
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
View file @
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
View file @
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
...
...
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