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
0d89c1d2
Commit
0d89c1d2
authored
May 25, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release/poc5-rc9'
parents
7f1a4c37
818bc845
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
113 additions
and
33 deletions
+113
-33
README.md
README.md
+1
-1
wallet.qml
ethereal/assets/qml/wallet.qml
+4
-5
config.go
ethereal/config.go
+2
-0
ethereum.go
ethereal/ethereum.go
+1
-1
gui.go
ethereal/ui/gui.go
+13
-8
ui_lib.go
ethereal/ui/ui_lib.go
+1
-1
config.go
ethereum/config.go
+2
-1
ethereum.go
ethereum/ethereum.go
+5
-2
javascript_runtime.go
ethereum/javascript_runtime.go
+14
-1
repl.go
ethereum/repl.go
+12
-3
repl_darwin.go
ethereum/repl_darwin.go
+28
-2
cmd.go
utils/cmd.go
+30
-8
No files found.
README.md
View file @
0d89c1d2
...
@@ -5,7 +5,7 @@ Ethereum
...
@@ -5,7 +5,7 @@ Ethereum
Ethereum Go Client © 2014 Jeffrey Wilcke.
Ethereum Go Client © 2014 Jeffrey Wilcke.
Current state: Proof of Concept 5.0 RC
8
.
Current state: Proof of Concept 5.0 RC
9
.
For the development package please see the
[
eth-go package
](
https://github.com/ethereum/eth-go
)
.
For the development package please see the
[
eth-go package
](
https://github.com/ethereum/eth-go
)
.
...
...
ethereal/assets/qml/wallet.qml
View file @
0d89c1d2
...
@@ -85,7 +85,6 @@ ApplicationWindow {
...
@@ -85,7 +85,6 @@ ApplicationWindow {
//color: "#D9DDE7"
//color: "#D9DDE7"
color
:
"#252525"
color
:
"#252525"
ColumnLayout
{
ColumnLayout
{
y
:
50
y
:
50
anchors.left
:
parent
.
left
anchors.left
:
parent
.
left
...
@@ -155,6 +154,7 @@ ApplicationWindow {
...
@@ -155,6 +154,7 @@ ApplicationWindow {
TableView
{
TableView
{
id
:
txTableView
id
:
txTableView
anchors.fill
:
parent
anchors.fill
:
parent
TableViewColumn
{
role
:
"inout"
;
title
:
""
;
width
:
40
}
TableViewColumn
{
role
:
"value"
;
title
:
"Value"
;
width
:
100
}
TableViewColumn
{
role
:
"value"
;
title
:
"Value"
;
width
:
100
}
TableViewColumn
{
role
:
"address"
;
title
:
"Address"
;
width
:
430
}
TableViewColumn
{
role
:
"address"
;
title
:
"Address"
;
width
:
430
}
TableViewColumn
{
role
:
"contract"
;
title
:
"Contract"
;
width
:
100
}
TableViewColumn
{
role
:
"contract"
;
title
:
"Contract"
;
width
:
100
}
...
@@ -404,7 +404,7 @@ ApplicationWindow {
...
@@ -404,7 +404,7 @@ ApplicationWindow {
anchors.left
:
aboutIcon
.
right
anchors.left
:
aboutIcon
.
right
anchors.leftMargin
:
10
anchors.leftMargin
:
10
font.pointSize
:
12
font.pointSize
:
12
text
:
"<h2>Ethereal</h2><br><h3>Development</h3>Jeffrey Wilcke<br>Maran Hidskes<br>
<h3>Binary Distribution</h3>Jarrad Hope<br>
"
text
:
"<h2>Ethereal</h2><br><h3>Development</h3>Jeffrey Wilcke<br>Maran Hidskes<br>"
}
}
}
}
...
@@ -429,7 +429,6 @@ ApplicationWindow {
...
@@ -429,7 +429,6 @@ ApplicationWindow {
}
}
}
}
SplitView
{
SplitView
{
anchors.fill
:
parent
anchors.fill
:
parent
property
var
asmModel
:
ListModel
{
property
var
asmModel
:
ListModel
{
id
:
asmModel
id
:
asmModel
...
@@ -524,14 +523,14 @@ ApplicationWindow {
...
@@ -524,14 +523,14 @@ ApplicationWindow {
walletValueLabel
.
text
=
value
walletValueLabel
.
text
=
value
}
}
function
addTx
(
tx
)
{
function
addTx
(
tx
,
inout
)
{
var
isContract
var
isContract
if
(
tx
.
contract
==
true
){
if
(
tx
.
contract
==
true
){
isContract
=
"Yes"
isContract
=
"Yes"
}
else
{
}
else
{
isContract
=
"No"
isContract
=
"No"
}
}
txModel
.
insert
(
0
,
{
hash
:
tx
.
hash
,
address
:
tx
.
address
,
value
:
tx
.
value
,
contract
:
isContract
})
txModel
.
insert
(
0
,
{
inout
:
inout
,
hash
:
tx
.
hash
,
address
:
tx
.
address
,
value
:
tx
.
value
,
contract
:
isContract
})
}
}
function
addBlock
(
block
)
{
function
addBlock
(
block
)
{
...
...
ethereal/config.go
View file @
0d89c1d2
...
@@ -4,6 +4,7 @@ import (
...
@@ -4,6 +4,7 @@ import (
"flag"
"flag"
)
)
var
Identifier
string
var
StartConsole
bool
var
StartConsole
bool
var
StartMining
bool
var
StartMining
bool
var
StartRpc
bool
var
StartRpc
bool
...
@@ -21,6 +22,7 @@ var DataDir string
...
@@ -21,6 +22,7 @@ var DataDir string
var
AssetPath
string
var
AssetPath
string
func
Init
()
{
func
Init
()
{
flag
.
StringVar
(
&
Identifier
,
"i"
,
""
,
"Custom client identifier"
)
flag
.
BoolVar
(
&
StartConsole
,
"c"
,
false
,
"debug and testing console"
)
flag
.
BoolVar
(
&
StartConsole
,
"c"
,
false
,
"debug and testing console"
)
flag
.
BoolVar
(
&
StartMining
,
"m"
,
false
,
"start dagger mining"
)
flag
.
BoolVar
(
&
StartMining
,
"m"
,
false
,
"start dagger mining"
)
flag
.
BoolVar
(
&
StartRpc
,
"r"
,
false
,
"start rpc server"
)
flag
.
BoolVar
(
&
StartRpc
,
"r"
,
false
,
"start rpc server"
)
...
...
ethereal/ethereum.go
View file @
0d89c1d2
...
@@ -39,7 +39,7 @@ func main() {
...
@@ -39,7 +39,7 @@ func main() {
runtime
.
GOMAXPROCS
(
runtime
.
NumCPU
())
runtime
.
GOMAXPROCS
(
runtime
.
NumCPU
())
ethchain
.
InitFees
()
ethchain
.
InitFees
()
ethutil
.
ReadConfig
(
DataDir
,
ethutil
.
LogFile
|
ethutil
.
LogStd
)
ethutil
.
ReadConfig
(
DataDir
,
ethutil
.
LogFile
|
ethutil
.
LogStd
,
Identifier
)
// Instantiated a eth stack
// Instantiated a eth stack
ethereum
,
err
:=
eth
.
New
(
eth
.
CapDefault
,
UseUPnP
)
ethereum
,
err
:=
eth
.
New
(
eth
.
CapDefault
,
UseUPnP
)
...
...
ethereal/ui/gui.go
View file @
0d89c1d2
...
@@ -9,7 +9,6 @@ import (
...
@@ -9,7 +9,6 @@ import (
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
"github.com/go-qml/qml"
"github.com/go-qml/qml"
"github.com/obscuren/mutan"
"math/big"
"math/big"
"strings"
"strings"
)
)
...
@@ -55,7 +54,7 @@ func New(ethereum *eth.Ethereum) *Gui {
...
@@ -55,7 +54,7 @@ func New(ethereum *eth.Ethereum) *Gui {
}
}
func
(
gui
*
Gui
)
Start
(
assetPath
string
)
{
func
(
gui
*
Gui
)
Start
(
assetPath
string
)
{
const
version
=
"0.5.0 RC
8
"
const
version
=
"0.5.0 RC
9
"
defer
gui
.
txDb
.
Close
()
defer
gui
.
txDb
.
Close
()
...
@@ -152,7 +151,15 @@ func (gui *Gui) readPreviousTransactions() {
...
@@ -152,7 +151,15 @@ func (gui *Gui) readPreviousTransactions() {
for
it
.
Next
()
{
for
it
.
Next
()
{
tx
:=
ethchain
.
NewTransactionFromBytes
(
it
.
Value
())
tx
:=
ethchain
.
NewTransactionFromBytes
(
it
.
Value
())
gui
.
win
.
Root
()
.
Call
(
"addTx"
,
ethpub
.
NewPTx
(
tx
))
var
inout
string
if
bytes
.
Compare
(
tx
.
Sender
(),
gui
.
addr
)
==
0
{
inout
=
"send"
}
else
{
inout
=
"recv"
}
gui
.
win
.
Root
()
.
Call
(
"addTx"
,
ethpub
.
NewPTx
(
tx
),
inout
)
}
}
it
.
Release
()
it
.
Release
()
}
}
...
@@ -208,12 +215,12 @@ func (gui *Gui) update() {
...
@@ -208,12 +215,12 @@ func (gui *Gui) update() {
object
:=
state
.
GetAccount
(
gui
.
addr
)
object
:=
state
.
GetAccount
(
gui
.
addr
)
if
bytes
.
Compare
(
tx
.
Sender
(),
gui
.
addr
)
==
0
{
if
bytes
.
Compare
(
tx
.
Sender
(),
gui
.
addr
)
==
0
{
gui
.
win
.
Root
()
.
Call
(
"addTx"
,
ethpub
.
NewPTx
(
tx
))
gui
.
win
.
Root
()
.
Call
(
"addTx"
,
ethpub
.
NewPTx
(
tx
)
,
"send"
)
gui
.
txDb
.
Put
(
tx
.
Hash
(),
tx
.
RlpEncode
())
gui
.
txDb
.
Put
(
tx
.
Hash
(),
tx
.
RlpEncode
())
unconfirmedFunds
.
Sub
(
unconfirmedFunds
,
tx
.
Value
)
unconfirmedFunds
.
Sub
(
unconfirmedFunds
,
tx
.
Value
)
}
else
if
bytes
.
Compare
(
tx
.
Recipient
,
gui
.
addr
)
==
0
{
}
else
if
bytes
.
Compare
(
tx
.
Recipient
,
gui
.
addr
)
==
0
{
gui
.
win
.
Root
()
.
Call
(
"addTx"
,
ethpub
.
NewPTx
(
tx
))
gui
.
win
.
Root
()
.
Call
(
"addTx"
,
ethpub
.
NewPTx
(
tx
)
,
"recv"
)
gui
.
txDb
.
Put
(
tx
.
Hash
(),
tx
.
RlpEncode
())
gui
.
txDb
.
Put
(
tx
.
Hash
(),
tx
.
RlpEncode
())
unconfirmedFunds
.
Add
(
unconfirmedFunds
,
tx
.
Value
)
unconfirmedFunds
.
Add
(
unconfirmedFunds
,
tx
.
Value
)
...
@@ -262,7 +269,5 @@ func (gui *Gui) Transact(recipient, value, gas, gasPrice, data string) (*ethpub.
...
@@ -262,7 +269,5 @@ func (gui *Gui) Transact(recipient, value, gas, gasPrice, data string) (*ethpub.
func
(
gui
*
Gui
)
Create
(
recipient
,
value
,
gas
,
gasPrice
,
data
string
)
(
*
ethpub
.
PReceipt
,
error
)
{
func
(
gui
*
Gui
)
Create
(
recipient
,
value
,
gas
,
gasPrice
,
data
string
)
(
*
ethpub
.
PReceipt
,
error
)
{
keyPair
:=
ethutil
.
GetKeyRing
()
.
Get
(
0
)
keyPair
:=
ethutil
.
GetKeyRing
()
.
Get
(
0
)
mainInput
,
initInput
:=
mutan
.
PreParse
(
data
)
return
gui
.
pub
.
Create
(
ethutil
.
Hex
(
keyPair
.
PrivateKey
),
value
,
gas
,
gasPrice
,
data
)
return
gui
.
pub
.
Create
(
ethutil
.
Hex
(
keyPair
.
PrivateKey
),
value
,
gas
,
gasPrice
,
initInput
,
mainInput
)
}
}
ethereal/ui/ui_lib.go
View file @
0d89c1d2
...
@@ -135,7 +135,7 @@ func (ui *UiLib) DebugTx(recipient, valueStr, gasStr, gasPriceStr, data string)
...
@@ -135,7 +135,7 @@ func (ui *UiLib) DebugTx(recipient, valueStr, gasStr, gasPriceStr, data string)
for
_
,
str
:=
range
dis
{
for
_
,
str
:=
range
dis
{
ui
.
win
.
Root
()
.
Call
(
"setAsm"
,
str
)
ui
.
win
.
Root
()
.
Call
(
"setAsm"
,
str
)
}
}
callerTx
:=
ethchain
.
NewContractCreationTx
(
ethutil
.
Big
(
valueStr
),
ethutil
.
Big
(
gasStr
),
ethutil
.
Big
(
gasPriceStr
),
callerScript
,
nil
)
callerTx
:=
ethchain
.
NewContractCreationTx
(
ethutil
.
Big
(
valueStr
),
ethutil
.
Big
(
gasStr
),
ethutil
.
Big
(
gasPriceStr
),
nil
)
// Contract addr as test address
// Contract addr as test address
keyPair
:=
ethutil
.
GetKeyRing
()
.
Get
(
0
)
keyPair
:=
ethutil
.
GetKeyRing
()
.
Get
(
0
)
...
...
ethereum/config.go
View file @
0d89c1d2
...
@@ -6,6 +6,7 @@ import (
...
@@ -6,6 +6,7 @@ import (
"os"
"os"
)
)
var
Identifier
string
var
StartMining
bool
var
StartMining
bool
var
StartRpc
bool
var
StartRpc
bool
var
RpcPort
int
var
RpcPort
int
...
@@ -30,6 +31,7 @@ func Init() {
...
@@ -30,6 +31,7 @@ func Init() {
flag
.
PrintDefaults
()
flag
.
PrintDefaults
()
}
}
flag
.
StringVar
(
&
Identifier
,
"i"
,
""
,
"custom client identifier"
)
flag
.
BoolVar
(
&
StartMining
,
"m"
,
false
,
"start dagger mining"
)
flag
.
BoolVar
(
&
StartMining
,
"m"
,
false
,
"start dagger mining"
)
flag
.
BoolVar
(
&
ShowGenesis
,
"g"
,
false
,
"prints genesis header and exits"
)
flag
.
BoolVar
(
&
ShowGenesis
,
"g"
,
false
,
"prints genesis header and exits"
)
flag
.
BoolVar
(
&
StartRpc
,
"r"
,
false
,
"start rpc server"
)
flag
.
BoolVar
(
&
StartRpc
,
"r"
,
false
,
"start rpc server"
)
...
@@ -45,7 +47,6 @@ func Init() {
...
@@ -45,7 +47,6 @@ func Init() {
flag
.
StringVar
(
&
ImportKey
,
"import"
,
""
,
"imports the given private key (hex)"
)
flag
.
StringVar
(
&
ImportKey
,
"import"
,
""
,
"imports the given private key (hex)"
)
flag
.
IntVar
(
&
MaxPeer
,
"x"
,
10
,
"maximum desired peers"
)
flag
.
IntVar
(
&
MaxPeer
,
"x"
,
10
,
"maximum desired peers"
)
flag
.
BoolVar
(
&
StartJsConsole
,
"js"
,
false
,
"exp"
)
flag
.
BoolVar
(
&
StartJsConsole
,
"js"
,
false
,
"exp"
)
//flag.StringVar(&InputFile, "e", "", "Run javascript file")
flag
.
Parse
()
flag
.
Parse
()
...
...
ethereum/ethereum.go
View file @
0d89c1d2
...
@@ -52,12 +52,15 @@ func main() {
...
@@ -52,12 +52,15 @@ func main() {
var
logSys
*
log
.
Logger
var
logSys
*
log
.
Logger
flags
:=
log
.
LstdFlags
flags
:=
log
.
LstdFlags
var
lt
ethutil
.
LoggerType
if
StartJsConsole
||
len
(
InputFile
)
>
0
{
if
StartJsConsole
||
len
(
InputFile
)
>
0
{
ethutil
.
ReadConfig
(
DataDir
,
ethutil
.
LogFile
)
lt
=
ethutil
.
LogFile
}
else
{
}
else
{
ethutil
.
ReadConfig
(
DataDir
,
ethutil
.
LogFile
|
ethutil
.
LogStd
)
lt
=
ethutil
.
LogFile
|
ethutil
.
LogStd
}
}
ethutil
.
ReadConfig
(
DataDir
,
lt
,
Identifier
)
logger
:=
ethutil
.
Config
.
Log
logger
:=
ethutil
.
Config
.
Log
if
LogFile
!=
""
{
if
LogFile
!=
""
{
...
...
ethereum/javascript_runtime.go
View file @
0d89c1d2
...
@@ -6,6 +6,7 @@ import (
...
@@ -6,6 +6,7 @@ import (
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/go-ethereum/utils"
"github.com/obscuren/otto"
"github.com/obscuren/otto"
"io/ioutil"
"io/ioutil"
"os"
"os"
...
@@ -116,14 +117,26 @@ func (self *JSRE) initStdFuncs() {
...
@@ -116,14 +117,26 @@ func (self *JSRE) initStdFuncs() {
eth
.
Set
(
"watch"
,
self
.
watch
)
eth
.
Set
(
"watch"
,
self
.
watch
)
eth
.
Set
(
"addPeer"
,
self
.
addPeer
)
eth
.
Set
(
"addPeer"
,
self
.
addPeer
)
eth
.
Set
(
"require"
,
self
.
require
)
eth
.
Set
(
"require"
,
self
.
require
)
eth
.
Set
(
"stopMining"
,
self
.
stopMining
)
eth
.
Set
(
"startMining"
,
self
.
startMining
)
}
}
/*
/*
* The following methods are natively implemented javascript functions
* The following methods are natively implemented javascript functions
*/
*/
func
(
self
*
JSRE
)
stopMining
(
call
otto
.
FunctionCall
)
otto
.
Value
{
v
,
_
:=
self
.
vm
.
ToValue
(
utils
.
StopMining
(
self
.
ethereum
))
return
v
}
func
(
self
*
JSRE
)
startMining
(
call
otto
.
FunctionCall
)
otto
.
Value
{
v
,
_
:=
self
.
vm
.
ToValue
(
utils
.
StartMining
(
self
.
ethereum
))
return
v
}
// eth.watch
// eth.watch
func
(
self
JSRE
)
watch
(
call
otto
.
FunctionCall
)
otto
.
Value
{
func
(
self
*
JSRE
)
watch
(
call
otto
.
FunctionCall
)
otto
.
Value
{
addr
,
_
:=
call
.
Argument
(
0
)
.
ToString
()
addr
,
_
:=
call
.
Argument
(
0
)
.
ToString
()
var
storageAddr
string
var
storageAddr
string
var
cb
otto
.
Value
var
cb
otto
.
Value
...
...
ethereum/repl.go
View file @
0d89c1d2
...
@@ -48,13 +48,22 @@ func (self *JSRepl) parseInput(code string) {
...
@@ -48,13 +48,22 @@ func (self *JSRepl) parseInput(code string) {
// The JSEthereum object attempts to wrap the PEthereum object and returns
// The JSEthereum object attempts to wrap the PEthereum object and returns
// meaningful javascript objects
// meaningful javascript objects
type
JSBlock
struct
{
*
ethpub
.
PBlock
eth
*
JSEthereum
}
func
(
self
*
JSBlock
)
GetTransaction
(
hash
string
)
otto
.
Value
{
return
self
.
eth
.
toVal
(
self
.
PBlock
.
GetTransaction
(
hash
))
}
type
JSEthereum
struct
{
type
JSEthereum
struct
{
*
ethpub
.
PEthereum
*
ethpub
.
PEthereum
vm
*
otto
.
Otto
vm
*
otto
.
Otto
}
}
func
(
self
*
JSEthereum
)
GetBlock
(
hash
string
)
otto
.
Value
{
func
(
self
*
JSEthereum
)
GetBlock
(
hash
string
)
otto
.
Value
{
return
self
.
toVal
(
self
.
PEthereum
.
GetBlock
(
hash
)
)
return
self
.
toVal
(
&
JSBlock
{
self
.
PEthereum
.
GetBlock
(
hash
),
self
}
)
}
}
func
(
self
*
JSEthereum
)
GetKey
()
otto
.
Value
{
func
(
self
*
JSEthereum
)
GetKey
()
otto
.
Value
{
...
@@ -76,8 +85,8 @@ func (self *JSEthereum) Transact(key, recipient, valueStr, gasStr, gasPriceStr,
...
@@ -76,8 +85,8 @@ func (self *JSEthereum) Transact(key, recipient, valueStr, gasStr, gasPriceStr,
return
self
.
toVal
(
r
)
return
self
.
toVal
(
r
)
}
}
func
(
self
*
JSEthereum
)
Create
(
key
,
valueStr
,
gasStr
,
gasPriceStr
,
initStr
,
body
Str
string
)
otto
.
Value
{
func
(
self
*
JSEthereum
)
Create
(
key
,
valueStr
,
gasStr
,
gasPriceStr
,
script
Str
string
)
otto
.
Value
{
r
,
err
:=
self
.
PEthereum
.
Create
(
key
,
valueStr
,
gasStr
,
gasPriceStr
,
initStr
,
body
Str
)
r
,
err
:=
self
.
PEthereum
.
Create
(
key
,
valueStr
,
gasStr
,
gasPriceStr
,
script
Str
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Println
(
err
)
fmt
.
Println
(
err
)
...
...
ethereum/repl_darwin.go
View file @
0d89c1d2
package
main
package
main
// #cgo darwin CFLAGS: -I/usr/local/opt/readline/include
// #cgo darwin LDFLAGS: -L/usr/local/opt/readline/lib
// #cgo LDFLAGS: -lreadline
// #cgo LDFLAGS: -lreadline
// #include <stdio.h>
// #include <stdio.h>
// #include <stdlib.h>
// #include <stdlib.h>
// #include <readline/readline.h>
// #include <readline/readline.h>
// #include <readline/history.h>
// #include <readline/history.h>
import
"C"
import
"C"
import
(
import
(
"os"
"os/signal"
"strings"
"strings"
"syscall"
"unsafe"
"unsafe"
)
)
func
initReadLine
()
{
C
.
rl_catch_sigwinch
=
0
C
.
rl_catch_signals
=
0
c
:=
make
(
chan
os
.
Signal
,
1
)
signal
.
Notify
(
c
,
syscall
.
SIGWINCH
)
signal
.
Notify
(
c
,
os
.
Interrupt
)
go
func
()
{
for
sig
:=
range
c
{
switch
sig
{
case
syscall
.
SIGWINCH
:
C
.
rl_resize_terminal
()
case
os
.
Interrupt
:
C
.
rl_cleanup_after_signal
()
default
:
}
}
}()
}
func
readLine
(
prompt
*
string
)
*
string
{
func
readLine
(
prompt
*
string
)
*
string
{
var
p
*
C
.
char
var
p
*
C
.
char
...
@@ -59,6 +84,7 @@ func (self *JSRepl) setIndent() {
...
@@ -59,6 +84,7 @@ func (self *JSRepl) setIndent() {
}
}
func
(
self
*
JSRepl
)
read
()
{
func
(
self
*
JSRepl
)
read
()
{
initReadLine
()
L
:
L
:
for
{
for
{
switch
result
:=
readLine
(
&
self
.
prompt
);
true
{
switch
result
:=
readLine
(
&
self
.
prompt
);
true
{
...
@@ -76,7 +102,7 @@ L:
...
@@ -76,7 +102,7 @@ L:
break
L
break
L
}
}
addHistory
(
str
)
//allow user to recall this line
addHistory
(
str
[
:
len
(
str
)
-
1
]
)
//allow user to recall this line
self
.
parseInput
(
str
)
self
.
parseInput
(
str
)
...
...
utils/cmd.go
View file @
0d89c1d2
...
@@ -19,6 +19,8 @@ func DoRpc(ethereum *eth.Ethereum, RpcPort int) {
...
@@ -19,6 +19,8 @@ func DoRpc(ethereum *eth.Ethereum, RpcPort int) {
}
}
}
}
var
miner
ethminer
.
Miner
func
DoMining
(
ethereum
*
eth
.
Ethereum
)
{
func
DoMining
(
ethereum
*
eth
.
Ethereum
)
{
// Set Mining status
// Set Mining status
ethereum
.
Mining
=
true
ethereum
.
Mining
=
true
...
@@ -31,17 +33,37 @@ func DoMining(ethereum *eth.Ethereum) {
...
@@ -31,17 +33,37 @@ func DoMining(ethereum *eth.Ethereum) {
addr
:=
keyPair
.
Address
()
addr
:=
keyPair
.
Address
()
go
func
()
{
go
func
()
{
ethutil
.
Config
.
Log
.
Infoln
(
"Miner started"
)
miner
=
ethminer
.
NewDefaultMiner
(
addr
,
ethereum
)
// Give it some time to connect with peers
// Give it some time to connect with peers
time
.
Sleep
(
3
*
time
.
Second
)
time
.
Sleep
(
3
*
time
.
Second
)
/*
for ethereum.IsUpToDate() == false {
time.Sleep(5 * time.Second)
}
*/
ethutil
.
Config
.
Log
.
Infoln
(
"Miner started"
)
miner
:=
ethminer
.
NewDefaultMiner
(
addr
,
ethereum
)
miner
.
Start
()
miner
.
Start
()
}()
}()
}
}
func
StopMining
(
ethereum
*
eth
.
Ethereum
)
bool
{
if
ethereum
.
Mining
{
miner
.
Stop
()
ethutil
.
Config
.
Log
.
Infoln
(
"Miner stopped"
)
ethereum
.
Mining
=
false
return
true
}
return
false
}
func
StartMining
(
ethereum
*
eth
.
Ethereum
)
bool
{
if
!
ethereum
.
Mining
{
DoMining
(
ethereum
)
return
true
}
return
false
}
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