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
02acef23
Commit
02acef23
authored
Feb 11, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Interop!
parent
5a83114e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
17 deletions
+21
-17
ethereum.go
ethereum.go
+17
-14
peer.go
peer.go
+4
-3
No files found.
ethereum.go
View file @
02acef23
...
...
@@ -60,8 +60,8 @@ type Ethereum struct {
}
func
New
(
caps
Caps
,
usePnp
bool
)
(
*
Ethereum
,
error
)
{
db
,
err
:=
ethdb
.
NewLDBDatabase
()
//
db, err := ethdb.NewMemDatabase()
//
db, err := ethdb.NewLDBDatabase()
db
,
err
:=
ethdb
.
NewMemDatabase
()
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -246,6 +246,8 @@ func (s *Ethereum) Start() {
// Start the tx pool
s
.
TxPool
.
Start
()
if
ethutil
.
Config
.
Seed
{
// Testnet seed bootstrapping
resp
,
err
:=
http
.
Get
(
"http://www.ethereum.org/servers.poc2.txt"
)
if
err
!=
nil
{
log
.
Println
(
"Fetching seed failed:"
,
err
)
...
...
@@ -259,6 +261,7 @@ func (s *Ethereum) Start() {
}
s
.
ConnectToPeer
(
string
(
body
))
}
}
func
(
s
*
Ethereum
)
peerHandler
(
listener
net
.
Listener
)
{
...
...
peer.go
View file @
02acef23
...
...
@@ -204,6 +204,7 @@ func (p *Peer) HandleOutbound() {
// The ping timer. Makes sure that every 2 minutes a ping is send to the peer
pingTimer
:=
time
.
NewTicker
(
2
*
time
.
Minute
)
serviceTimer
:=
time
.
NewTicker
(
5
*
time
.
Minute
)
out
:
for
{
select
{
...
...
@@ -442,7 +443,7 @@ func (p *Peer) pushHandshake() error {
clientId
:=
fmt
.
Sprintf
(
"/Ethereum(G) v%s/%s"
,
ethutil
.
Config
.
Ver
,
runtime
.
GOOS
)
msg
:=
ethwire
.
NewMessage
(
ethwire
.
MsgHandshakeTy
,
[]
interface
{}{
uint32
(
3
),
uint32
(
0
),
clientId
,
byte
(
p
.
caps
),
p
.
port
,
pubkey
,
uint32
(
4
),
uint32
(
0
),
clientId
,
byte
(
p
.
caps
),
p
.
port
,
pubkey
,
})
p
.
QueueMessage
(
msg
)
...
...
@@ -469,8 +470,8 @@ func (p *Peer) pushPeers() {
func
(
p
*
Peer
)
handleHandshake
(
msg
*
ethwire
.
Msg
)
{
c
:=
msg
.
Data
if
c
.
Get
(
0
)
.
AsUint
()
!=
3
{
log
.
Println
(
"Invalid peer version. Require protocol v
3
"
)
if
c
.
Get
(
0
)
.
AsUint
()
!=
4
{
log
.
Println
(
"Invalid peer version. Require protocol v
4
"
)
p
.
Stop
()
return
}
...
...
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