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
e954c24a
Commit
e954c24a
authored
Mar 23, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement RPC net_version
parent
60020add
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
7 deletions
+11
-7
backend.go
eth/backend.go
+7
-5
api.go
rpc/api.go
+1
-1
xeth.go
xeth/xeth.go
+3
-1
No files found.
eth/backend.go
View file @
e954c24a
...
...
@@ -13,6 +13,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
...
...
@@ -21,7 +22,6 @@ import (
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/nat"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/whisper"
)
...
...
@@ -141,8 +141,8 @@ type Ethereum struct {
Mining
bool
DataDir
string
version
string
P
rotocolVersion
int
N
etworkId
int
p
rotocolVersion
int
n
etworkId
int
}
func
New
(
config
*
Config
)
(
*
Ethereum
,
error
)
{
...
...
@@ -185,8 +185,8 @@ func New(config *Config) (*Ethereum, error) {
accountManager
:
config
.
AccountManager
,
DataDir
:
config
.
DataDir
,
version
:
config
.
Name
,
// TODO should separate from Name
P
rotocolVersion
:
config
.
ProtocolVersion
,
N
etworkId
:
config
.
NetworkId
,
p
rotocolVersion
:
config
.
ProtocolVersion
,
n
etworkId
:
config
.
NetworkId
,
}
eth
.
chainManager
=
core
.
NewChainManager
(
blockDb
,
stateDb
,
eth
.
EventMux
())
...
...
@@ -325,6 +325,8 @@ func (s *Ethereum) PeerCount() int { return s.net.PeerCoun
func
(
s
*
Ethereum
)
Peers
()
[]
*
p2p
.
Peer
{
return
s
.
net
.
Peers
()
}
func
(
s
*
Ethereum
)
MaxPeers
()
int
{
return
s
.
net
.
MaxPeers
}
func
(
s
*
Ethereum
)
Version
()
string
{
return
s
.
version
}
func
(
s
*
Ethereum
)
ProtocolVersion
()
int
{
return
s
.
protocolVersion
}
func
(
s
*
Ethereum
)
NetworkId
()
int
{
return
s
.
networkId
}
// Start the ethereum
func
(
s
*
Ethereum
)
Start
()
error
{
...
...
rpc/api.go
View file @
e954c24a
...
...
@@ -62,7 +62,7 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
case
"web3_clientVersion"
:
*
reply
=
api
.
xeth
()
.
Backend
()
.
Version
()
case
"net_version"
:
return
NewNotImplementedError
(
req
.
Method
)
*
reply
=
string
(
api
.
xeth
()
.
Backend
()
.
ProtocolVersion
()
)
case
"net_listening"
:
*
reply
=
api
.
xeth
()
.
IsListening
()
case
"net_peerCount"
:
...
...
xeth/xeth.go
View file @
e954c24a
...
...
@@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/event"
...
...
@@ -19,7 +20,6 @@ import (
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/whisper"
)
...
...
@@ -50,6 +50,8 @@ type Backend interface {
StartMining
()
error
StopMining
()
Version
()
string
ProtocolVersion
()
int
NetworkId
()
int
}
// Frontend should be implemented by users of XEth. Its methods are
...
...
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