good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
17cd7a58
Commit
17cd7a58
authored
Mar 16, 2015
by
Viktor Trón
Browse files
Options
Downloads
Patches
Plain Diff
remove long-running mining test, ethutil -> common
parent
b3e133dd
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmd/ethereum/admin.go
+6
-6
6 additions, 6 deletions
cmd/ethereum/admin.go
cmd/ethereum/js_test.go
+2
-40
2 additions, 40 deletions
cmd/ethereum/js_test.go
with
8 additions
and
46 deletions
cmd/ethereum/admin.go
+
6
−
6
View file @
17cd7a58
...
@@ -9,7 +9,7 @@ import (
...
@@ -9,7 +9,7 @@ import (
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/
ethutil
"
"github.com/ethereum/go-ethereum/
common
"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/state"
...
@@ -121,11 +121,11 @@ func (js *jsre) unlock(call otto.FunctionCall) otto.Value {
...
@@ -121,11 +121,11 @@ func (js *jsre) unlock(call otto.FunctionCall) otto.Value {
}
}
}
}
am
:=
js
.
ethereum
.
AccountManager
()
am
:=
js
.
ethereum
.
AccountManager
()
// err := am.Unlock(
ethutil
.FromHex(split[0]), split[1])
// err := am.Unlock(
common
.FromHex(split[0]), split[1])
// if err != nil {
// if err != nil {
// utils.Fatalf("Unlock account failed '%v'", err)
// utils.Fatalf("Unlock account failed '%v'", err)
// }
// }
err
=
am
.
TimedUnlock
(
ethutil
.
FromHex
(
addr
),
passphrase
,
time
.
Duration
(
seconds
)
*
time
.
Second
)
err
=
am
.
TimedUnlock
(
common
.
FromHex
(
addr
),
passphrase
,
time
.
Duration
(
seconds
)
*
time
.
Second
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Printf
(
"Unlock account failed '%v'
\n
"
,
err
)
fmt
.
Printf
(
"Unlock account failed '%v'
\n
"
,
err
)
return
otto
.
FalseValue
()
return
otto
.
FalseValue
()
...
@@ -164,7 +164,7 @@ func (js *jsre) newAccount(call otto.FunctionCall) otto.Value {
...
@@ -164,7 +164,7 @@ func (js *jsre) newAccount(call otto.FunctionCall) otto.Value {
fmt
.
Printf
(
"Could not create the account: %v"
,
err
)
fmt
.
Printf
(
"Could not create the account: %v"
,
err
)
return
otto
.
UndefinedValue
()
return
otto
.
UndefinedValue
()
}
}
return
js
.
re
.
ToVal
(
ethutil
.
Bytes2Hex
(
acct
.
Address
))
return
js
.
re
.
ToVal
(
common
.
Bytes2Hex
(
acct
.
Address
))
}
}
func
(
js
*
jsre
)
nodeInfo
(
call
otto
.
FunctionCall
)
otto
.
Value
{
func
(
js
*
jsre
)
nodeInfo
(
call
otto
.
FunctionCall
)
otto
.
Value
{
...
@@ -223,7 +223,7 @@ func (js *jsre) exportChain(call otto.FunctionCall) otto.Value {
...
@@ -223,7 +223,7 @@ func (js *jsre) exportChain(call otto.FunctionCall) otto.Value {
}
}
data
:=
js
.
ethereum
.
ChainManager
()
.
Export
()
data
:=
js
.
ethereum
.
ChainManager
()
.
Export
()
if
err
:=
ethutil
.
WriteFile
(
fn
,
data
);
err
!=
nil
{
if
err
:=
common
.
WriteFile
(
fn
,
data
);
err
!=
nil
{
fmt
.
Println
(
err
)
fmt
.
Println
(
err
)
return
otto
.
FalseValue
()
return
otto
.
FalseValue
()
}
}
...
@@ -239,7 +239,7 @@ func (js *jsre) dumpBlock(call otto.FunctionCall) otto.Value {
...
@@ -239,7 +239,7 @@ func (js *jsre) dumpBlock(call otto.FunctionCall) otto.Value {
block
=
js
.
ethereum
.
ChainManager
()
.
GetBlockByNumber
(
uint64
(
num
))
block
=
js
.
ethereum
.
ChainManager
()
.
GetBlockByNumber
(
uint64
(
num
))
}
else
if
call
.
Argument
(
0
)
.
IsString
()
{
}
else
if
call
.
Argument
(
0
)
.
IsString
()
{
hash
,
_
:=
call
.
Argument
(
0
)
.
ToString
()
hash
,
_
:=
call
.
Argument
(
0
)
.
ToString
()
block
=
js
.
ethereum
.
ChainManager
()
.
GetBlock
(
ethutil
.
Hex2Bytes
(
hash
))
block
=
js
.
ethereum
.
ChainManager
()
.
GetBlock
(
common
.
Hex2Bytes
(
hash
))
}
else
{
}
else
{
fmt
.
Println
(
"invalid argument for dump. Either hex string or number"
)
fmt
.
Println
(
"invalid argument for dump. Either hex string or number"
)
}
}
...
...
This diff is collapsed.
Click to expand it.
cmd/ethereum/js_test.go
+
2
−
40
View file @
17cd7a58
...
@@ -8,9 +8,9 @@ import (
...
@@ -8,9 +8,9 @@ import (
"testing"
"testing"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethutil"
)
)
var
port
=
30300
var
port
=
30300
...
@@ -29,7 +29,7 @@ func testJEthRE(t *testing.T) (repl *jsre, ethereum *eth.Ethereum, err error) {
...
@@ -29,7 +29,7 @@ func testJEthRE(t *testing.T) (repl *jsre, ethereum *eth.Ethereum, err error) {
}
}
// FIXME: this does not work ATM
// FIXME: this does not work ATM
ks
:=
crypto
.
NewKeyStorePlain
(
"/tmp/eth/keys"
)
ks
:=
crypto
.
NewKeyStorePlain
(
"/tmp/eth/keys"
)
ethutil
.
WriteFile
(
"/tmp/eth/keys/e273f01c99144c438695e10f24926dc1f9fbf62d/e273f01c99144c438695e10f24926dc1f9fbf62d"
,
common
.
WriteFile
(
"/tmp/eth/keys/e273f01c99144c438695e10f24926dc1f9fbf62d/e273f01c99144c438695e10f24926dc1f9fbf62d"
,
[]
byte
(
`{"Id":"RhRXD+fNRKS4jx+7ZfEsNA==","Address":"4nPwHJkUTEOGleEPJJJtwfn79i0=","PrivateKey":"h4ACVpe74uIvi5Cg/2tX/Yrm2xdr3J7QoMbMtNX2CNc="}`
))
[]
byte
(
`{"Id":"RhRXD+fNRKS4jx+7ZfEsNA==","Address":"4nPwHJkUTEOGleEPJJJtwfn79i0=","PrivateKey":"h4ACVpe74uIvi5Cg/2tX/Yrm2xdr3J7QoMbMtNX2CNc="}`
))
port
++
port
++
...
@@ -226,44 +226,6 @@ func TestMining(t *testing.T) {
...
@@ -226,44 +226,6 @@ func TestMining(t *testing.T) {
t
.
Errorf
(
"expected false (not mining), got true"
)
t
.
Errorf
(
"expected false (not mining), got true"
)
}
}
val
,
err
=
repl
.
re
.
Run
(
"admin.startMining(4)"
)
if
err
!=
nil
{
t
.
Errorf
(
"expected no error, got %v"
,
err
)
}
mining
,
_
=
val
.
ToBoolean
()
if
!
mining
{
t
.
Errorf
(
"expected true (mining), got false"
)
}
val
,
err
=
repl
.
re
.
Run
(
"eth.mining"
)
if
err
!=
nil
{
t
.
Errorf
(
"expected no error, got %v"
,
err
)
}
mining
,
err
=
val
.
ToBoolean
()
if
err
!=
nil
{
t
.
Errorf
(
"expected boolean, got %v"
,
err
)
}
if
!
mining
{
t
.
Errorf
(
"expected true (mining), got false"
)
}
val
,
err
=
repl
.
re
.
Run
(
"admin.startMining(4)"
)
if
err
!=
nil
{
t
.
Errorf
(
"expected no error, got %v"
,
err
)
}
mining
,
_
=
val
.
ToBoolean
()
if
!
mining
{
t
.
Errorf
(
"expected true (mining), got false"
)
}
val
,
err
=
repl
.
re
.
Run
(
"admin.stopMining()"
)
if
err
!=
nil
{
t
.
Errorf
(
"expected no error, got %v"
,
err
)
}
mining
,
_
=
val
.
ToBoolean
()
if
!
mining
{
t
.
Errorf
(
"expected true (mining), got false"
)
}
}
}
func
TestRPC
(
t
*
testing
.
T
)
{
func
TestRPC
(
t
*
testing
.
T
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment