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
2737baa6
Commit
2737baa6
authored
Jun 22, 2015
by
Bas van Kervel
Committed by
Bas van Kervel
Jun 22, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed unittests
parent
f87501b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
36 deletions
+10
-36
js_test.go
cmd/geth/js_test.go
+10
-7
admin.go
rpc/api/admin.go
+0
-29
No files found.
cmd/geth/js_test.go
View file @
2737baa6
...
...
@@ -20,6 +20,8 @@ import (
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/rpc/comms"
"github.com/ethereum/go-ethereum/rpc/codec"
)
const
(
...
...
@@ -105,7 +107,8 @@ func testJEthRE(t *testing.T) (string, *testjethre, *eth.Ethereum) {
t
.
Errorf
(
"Error creating DocServer: %v"
,
err
)
}
tf
:=
&
testjethre
{
ds
:
ds
,
stateDb
:
ethereum
.
ChainManager
()
.
State
()
.
Copy
()}
repl
:=
newJSRE
(
ethereum
,
assetPath
,
""
,
""
,
false
,
tf
)
client
:=
comms
.
NewInProcClient
(
codec
.
JSON
)
repl
:=
newJSRE
(
ethereum
,
assetPath
,
""
,
client
,
false
,
tf
)
tf
.
jsre
=
repl
return
tmp
,
tf
,
ethereum
}
...
...
@@ -125,7 +128,7 @@ func TestNodeInfo(t *testing.T) {
defer
ethereum
.
Stop
()
defer
os
.
RemoveAll
(
tmp
)
want
:=
`{"DiscPort":0,"IP":"0.0.0.0","ListenAddr":"","Name":"test","NodeID":"4cb2fc32924e94277bf94b5e4c983beedb2eabd5a0bc941db32202735c6625d020ca14a5963d1738af43b6ac0a711d61b1a06de931a499fe2aa0b1a132a902b5","NodeUrl":"enode://4cb2fc32924e94277bf94b5e4c983beedb2eabd5a0bc941db32202735c6625d020ca14a5963d1738af43b6ac0a711d61b1a06de931a499fe2aa0b1a132a902b5@0.0.0.0:0","TCPPort":0,"Td":"131072"}`
checkEvalJSON
(
t
,
repl
,
`admin.nodeInfo
()
`
,
want
)
checkEvalJSON
(
t
,
repl
,
`admin.nodeInfo`
,
want
)
}
func
TestAccounts
(
t
*
testing
.
T
)
{
...
...
@@ -139,7 +142,7 @@ func TestAccounts(t *testing.T) {
checkEvalJSON
(
t
,
repl
,
`eth.accounts`
,
`["`
+
testAddress
+
`"]`
)
checkEvalJSON
(
t
,
repl
,
`eth.coinbase`
,
`"`
+
testAddress
+
`"`
)
val
,
err
:=
repl
.
re
.
Run
(
`
admin
.newAccount("password")`
)
val
,
err
:=
repl
.
re
.
Run
(
`
personal
.newAccount("password")`
)
if
err
!=
nil
{
t
.
Errorf
(
"expected no error, got %v"
,
err
)
}
...
...
@@ -161,7 +164,7 @@ func TestBlockChain(t *testing.T) {
defer
ethereum
.
Stop
()
defer
os
.
RemoveAll
(
tmp
)
// get current block dump before export/import.
val
,
err
:=
repl
.
re
.
Run
(
"JSON.stringify(
admin.debug.dumpBlock(
))"
)
val
,
err
:=
repl
.
re
.
Run
(
"JSON.stringify(
debug.dumpBlock(eth.blockNumber
))"
)
if
err
!=
nil
{
t
.
Errorf
(
"expected no error, got %v"
,
err
)
}
...
...
@@ -178,14 +181,14 @@ func TestBlockChain(t *testing.T) {
ethereum
.
ChainManager
()
.
Reset
()
checkEvalJSON
(
t
,
repl
,
`admin.export(`
+
tmpfileq
+
`)`
,
`true`
)
checkEvalJSON
(
t
,
repl
,
`admin.export
Chain
(`
+
tmpfileq
+
`)`
,
`true`
)
if
_
,
err
:=
os
.
Stat
(
tmpfile
);
err
!=
nil
{
t
.
Fatal
(
err
)
}
// check import, verify that dumpBlock gives the same result.
checkEvalJSON
(
t
,
repl
,
`admin.import(`
+
tmpfileq
+
`)`
,
`true`
)
checkEvalJSON
(
t
,
repl
,
`
admin.debug.dumpBlock(
)`
,
beforeExport
)
checkEvalJSON
(
t
,
repl
,
`admin.import
Chain
(`
+
tmpfileq
+
`)`
,
`true`
)
checkEvalJSON
(
t
,
repl
,
`
debug.dumpBlock(eth.blockNumber
)`
,
beforeExport
)
}
func
TestMining
(
t
*
testing
.
T
)
{
...
...
rpc/api/admin.go
View file @
2737baa6
...
...
@@ -23,8 +23,6 @@ const (
var
(
// mapping between methods and handlers
AdminMapping
=
map
[
string
]
adminhandler
{
// "admin_startRPC": (*adminApi).StartRPC,
// "admin_stopRPC": (*adminApi).StopRPC,
"admin_addPeer"
:
(
*
adminApi
)
.
AddPeer
,
"admin_peers"
:
(
*
adminApi
)
.
Peers
,
"admin_nodeInfo"
:
(
*
adminApi
)
.
NodeInfo
,
...
...
@@ -103,33 +101,6 @@ func (self *adminApi) Peers(req *shared.Request) (interface{}, error) {
return
self
.
ethereum
.
PeersInfo
(),
nil
}
func
(
self
*
adminApi
)
StartRPC
(
req
*
shared
.
Request
)
(
interface
{},
error
)
{
return
false
,
nil
// Enable when http rpc interface is refactored to prevent import cycles
// args := new(StartRpcArgs)
// if err := self.codec.Decode(req.Params, &args); err != nil {
// return nil, shared.NewDecodeParamError(err.Error())
// }
//
// cfg := rpc.RpcConfig{
// ListenAddress: args.Address,
// ListenPort: args.Port,
// }
//
// err := rpc.Start(self.xeth, cfg)
// if err == nil {
// return true, nil
// }
// return false, err
}
func
(
self
*
adminApi
)
StopRPC
(
req
*
shared
.
Request
)
(
interface
{},
error
)
{
return
false
,
nil
// Enable when http rpc interface is refactored to prevent import cycles
// rpc.Stop()
// return true, nil
}
func
(
self
*
adminApi
)
NodeInfo
(
req
*
shared
.
Request
)
(
interface
{},
error
)
{
return
self
.
ethereum
.
NodeInfo
(),
nil
}
...
...
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