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
33afb10b
Commit
33afb10b
authored
Nov 14, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up
parent
56aa2400
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
33 deletions
+22
-33
main.go
cmd/ethtest/main.go
+1
-1
gui.go
cmd/mist/gui.go
+14
-28
main.go
cmd/mist/main.go
+7
-4
No files found.
cmd/ethtest/main.go
View file @
33afb10b
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
*/
*/
/**
/**
* @authors
* @authors
:
* Jeffrey Wilcke <i@jev.io>
* Jeffrey Wilcke <i@jev.io>
* @date 2014
* @date 2014
*
*
...
...
cmd/mist/gui.go
View file @
33afb10b
...
@@ -63,6 +63,15 @@ func LoadExtension(path string) (uintptr, error) {
...
@@ -63,6 +63,15 @@ func LoadExtension(path string) (uintptr, error) {
return ptr.Interface().(uintptr), nil
return ptr.Interface().(uintptr), nil
}
}
*/
*/
/*
vec, errr := LoadExtension("/Users/jeffrey/Desktop/build-libqmltest-Desktop_Qt_5_2_1_clang_64bit-Debug/liblibqmltest_debug.dylib")
fmt.Printf("Fetched vec with addr: %#x\n", vec)
if errr != nil {
fmt.Println(errr)
} else {
context.SetVar("vec", (unsafe.Pointer)(vec))
}
*/
var
guilogger
=
logger
.
NewLogger
(
"GUI"
)
var
guilogger
=
logger
.
NewLogger
(
"GUI"
)
...
@@ -112,9 +121,10 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden
...
@@ -112,9 +121,10 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden
}
}
func
(
gui
*
Gui
)
Start
(
assetPath
string
)
{
func
(
gui
*
Gui
)
Start
(
assetPath
string
)
{
defer
gui
.
txDb
.
Close
()
defer
gui
.
txDb
.
Close
()
guilogger
.
Infoln
(
"Starting GUI"
)
// Register ethereum functions
// Register ethereum functions
qml
.
RegisterTypes
(
"Ethereum"
,
1
,
0
,
[]
qml
.
TypeSpec
{{
qml
.
RegisterTypes
(
"Ethereum"
,
1
,
0
,
[]
qml
.
TypeSpec
{{
Init
:
func
(
p
*
xeth
.
JSBlock
,
obj
qml
.
Object
)
{
p
.
Number
=
0
;
p
.
Hash
=
""
},
Init
:
func
(
p
*
xeth
.
JSBlock
,
obj
qml
.
Object
)
{
p
.
Number
=
0
;
p
.
Hash
=
""
},
...
@@ -132,16 +142,6 @@ func (gui *Gui) Start(assetPath string) {
...
@@ -132,16 +142,6 @@ func (gui *Gui) Start(assetPath string) {
context
.
SetVar
(
"gui"
,
gui
)
context
.
SetVar
(
"gui"
,
gui
)
context
.
SetVar
(
"eth"
,
gui
.
uiLib
)
context
.
SetVar
(
"eth"
,
gui
.
uiLib
)
/*
vec, errr := LoadExtension("/Users/jeffrey/Desktop/build-libqmltest-Desktop_Qt_5_2_1_clang_64bit-Debug/liblibqmltest_debug.dylib")
fmt.Printf("Fetched vec with addr: %#x\n", vec)
if errr != nil {
fmt.Println(errr)
} else {
context.SetVar("vec", (unsafe.Pointer)(vec))
}
*/
// Load the main QML interface
// Load the main QML interface
data
,
_
:=
ethutil
.
Config
.
Db
.
Get
([]
byte
(
"KeyRing"
))
data
,
_
:=
ethutil
.
Config
.
Db
.
Get
([]
byte
(
"KeyRing"
))
...
@@ -160,7 +160,6 @@ func (gui *Gui) Start(assetPath string) {
...
@@ -160,7 +160,6 @@ func (gui *Gui) Start(assetPath string) {
panic
(
err
)
panic
(
err
)
}
}
guilogger
.
Infoln
(
"Starting GUI"
)
gui
.
open
=
true
gui
.
open
=
true
win
.
Show
()
win
.
Show
()
...
@@ -245,7 +244,7 @@ func (gui *Gui) CreateAndSetPrivKey() (string, string, string, string) {
...
@@ -245,7 +244,7 @@ func (gui *Gui) CreateAndSetPrivKey() (string, string, string, string) {
return
gui
.
eth
.
KeyManager
()
.
KeyPair
()
.
AsStrings
()
return
gui
.
eth
.
KeyManager
()
.
KeyPair
()
.
AsStrings
()
}
}
func
(
gui
*
Gui
)
setInitialChain
Manager
(
)
{
func
(
gui
*
Gui
)
setInitialChain
(
ancientBlocks
bool
)
{
sBlk
:=
gui
.
eth
.
ChainManager
()
.
LastBlockHash
sBlk
:=
gui
.
eth
.
ChainManager
()
.
LastBlockHash
blk
:=
gui
.
eth
.
ChainManager
()
.
GetBlock
(
sBlk
)
blk
:=
gui
.
eth
.
ChainManager
()
.
GetBlock
(
sBlk
)
for
;
blk
!=
nil
;
blk
=
gui
.
eth
.
ChainManager
()
.
GetBlock
(
sBlk
)
{
for
;
blk
!=
nil
;
blk
=
gui
.
eth
.
ChainManager
()
.
GetBlock
(
sBlk
)
{
...
@@ -255,10 +254,6 @@ func (gui *Gui) setInitialChainManager() {
...
@@ -255,10 +254,6 @@ func (gui *Gui) setInitialChainManager() {
}
}
}
}
type
address
struct
{
Name
,
Address
string
}
func
(
gui
*
Gui
)
loadAddressBook
()
{
func
(
gui
*
Gui
)
loadAddressBook
()
{
view
:=
gui
.
getObjectByName
(
"infoView"
)
view
:=
gui
.
getObjectByName
(
"infoView"
)
nameReg
:=
gui
.
pipe
.
World
()
.
Config
()
.
Get
(
"NameReg"
)
nameReg
:=
gui
.
pipe
.
World
()
.
Config
()
.
Get
(
"NameReg"
)
...
@@ -385,11 +380,11 @@ func (self *Gui) getObjectByName(objectName string) qml.Object {
...
@@ -385,11 +380,11 @@ func (self *Gui) getObjectByName(objectName string) qml.Object {
func
(
gui
*
Gui
)
update
()
{
func
(
gui
*
Gui
)
update
()
{
// We have to wait for qml to be done loading all the windows.
// We have to wait for qml to be done loading all the windows.
for
!
gui
.
qmlDone
{
for
!
gui
.
qmlDone
{
time
.
Sleep
(
5
00
*
time
.
Millisecond
)
time
.
Sleep
(
3
00
*
time
.
Millisecond
)
}
}
go
func
()
{
go
func
()
{
go
gui
.
setInitialChain
Manager
(
)
go
gui
.
setInitialChain
(
false
)
gui
.
loadAddressBook
()
gui
.
loadAddressBook
()
gui
.
loadMergedMiningOptions
()
gui
.
loadMergedMiningOptions
()
gui
.
setPeerInfo
()
gui
.
setPeerInfo
()
...
@@ -493,14 +488,7 @@ func (gui *Gui) update() {
...
@@ -493,14 +488,7 @@ func (gui *Gui) update() {
case
<-
generalUpdateTicker
.
C
:
case
<-
generalUpdateTicker
.
C
:
statusText
:=
"#"
+
gui
.
eth
.
ChainManager
()
.
CurrentBlock
.
Number
.
String
()
statusText
:=
"#"
+
gui
.
eth
.
ChainManager
()
.
CurrentBlock
.
Number
.
String
()
lastBlockLabel
.
Set
(
"text"
,
statusText
)
lastBlockLabel
.
Set
(
"text"
,
statusText
)
miningLabel
.
Set
(
"text"
,
"Mining @ "
+
strconv
.
FormatInt
(
gui
.
uiLib
.
miner
.
GetPow
()
.
GetHashrate
(),
10
)
+
"Khash"
)
miningLabel
.
Set
(
"text"
,
"Mining @ "
+
strconv
.
FormatInt
(
gui
.
uiLib
.
miner
.
GetPow
()
.
GetHashrate
(),
10
)
+
"Khash"
)
/*
if gui.miner != nil {
pow := gui.miner.GetPow()
miningLabel.Set("text", "Mining @ "+strconv.FormatInt(pow.GetHashrate(), 10)+"Khash")
}
*/
blockLength
:=
gui
.
eth
.
BlockPool
()
.
BlocksProcessed
blockLength
:=
gui
.
eth
.
BlockPool
()
.
BlocksProcessed
chainLength
:=
gui
.
eth
.
BlockPool
()
.
ChainLength
chainLength
:=
gui
.
eth
.
BlockPool
()
.
ChainLength
...
@@ -510,7 +498,6 @@ func (gui *Gui) update() {
...
@@ -510,7 +498,6 @@ func (gui *Gui) update() {
dlWidget
=
gui
.
win
.
Root
()
.
ObjectByName
(
"downloadIndicator"
)
dlWidget
=
gui
.
win
.
Root
()
.
ObjectByName
(
"downloadIndicator"
)
dlLabel
=
gui
.
win
.
Root
()
.
ObjectByName
(
"downloadLabel"
)
dlLabel
=
gui
.
win
.
Root
()
.
ObjectByName
(
"downloadLabel"
)
)
)
dlWidget
.
Set
(
"value"
,
pct
)
dlWidget
.
Set
(
"value"
,
pct
)
dlLabel
.
Set
(
"text"
,
fmt
.
Sprintf
(
"%d / %d"
,
blockLength
,
chainLength
))
dlLabel
.
Set
(
"text"
,
fmt
.
Sprintf
(
"%d / %d"
,
blockLength
,
chainLength
))
...
@@ -549,7 +536,6 @@ NumGC: %d
...
@@ -549,7 +536,6 @@ NumGC: %d
func
(
gui
*
Gui
)
setPeerInfo
()
{
func
(
gui
*
Gui
)
setPeerInfo
()
{
gui
.
win
.
Root
()
.
Call
(
"setPeers"
,
fmt
.
Sprintf
(
"%d / %d"
,
gui
.
eth
.
PeerCount
(),
gui
.
eth
.
MaxPeers
))
gui
.
win
.
Root
()
.
Call
(
"setPeers"
,
fmt
.
Sprintf
(
"%d / %d"
,
gui
.
eth
.
PeerCount
(),
gui
.
eth
.
MaxPeers
))
gui
.
win
.
Root
()
.
Call
(
"resetPeers"
)
gui
.
win
.
Root
()
.
Call
(
"resetPeers"
)
for
_
,
peer
:=
range
gui
.
pipe
.
Peers
()
{
for
_
,
peer
:=
range
gui
.
pipe
.
Peers
()
{
gui
.
win
.
Root
()
.
Call
(
"addPeer"
,
peer
)
gui
.
win
.
Root
()
.
Call
(
"addPeer"
,
peer
)
...
...
cmd/mist/main.go
View file @
33afb10b
...
@@ -18,8 +18,10 @@
...
@@ -18,8 +18,10 @@
package
main
package
main
import
(
import
(
"fmt"
"os"
"os"
"runtime"
"runtime"
"time"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/cmd/utils"
...
@@ -38,6 +40,7 @@ func run() error {
...
@@ -38,6 +40,7 @@ func run() error {
// precedence: code-internal flag default < config file < environment variables < command line
// precedence: code-internal flag default < config file < environment variables < command line
Init
()
// parsing command line
Init
()
// parsing command line
tstart
:=
time
.
Now
()
config
:=
utils
.
InitConfig
(
VmType
,
ConfigFile
,
Datadir
,
"ETH"
)
config
:=
utils
.
InitConfig
(
VmType
,
ConfigFile
,
Datadir
,
"ETH"
)
utils
.
InitDataDir
(
Datadir
)
utils
.
InitDataDir
(
Datadir
)
...
@@ -51,14 +54,11 @@ func run() error {
...
@@ -51,14 +54,11 @@ func run() error {
os
.
Exit
(
1
)
os
.
Exit
(
1
)
}
}
keyManager
:=
utils
.
NewKeyManager
(
KeyStore
,
Datadir
,
db
)
keyManager
:=
utils
.
NewKeyManager
(
KeyStore
,
Datadir
,
db
)
// create, import, export keys
// create, import, export keys
utils
.
KeyTasks
(
keyManager
,
KeyRing
,
GenAddr
,
SecretFile
,
ExportDir
,
NonInteractive
)
utils
.
KeyTasks
(
keyManager
,
KeyRing
,
GenAddr
,
SecretFile
,
ExportDir
,
NonInteractive
)
clientIdentity
:=
utils
.
NewClientIdentity
(
ClientIdentifier
,
Version
,
Identifier
)
clientIdentity
:=
utils
.
NewClientIdentity
(
ClientIdentifier
,
Version
,
Identifier
)
ethereum
=
utils
.
NewEthereum
(
db
,
clientIdentity
,
keyManager
,
UseUPnP
,
OutboundPort
,
MaxPeer
)
ethereum
=
utils
.
NewEthereum
(
db
,
clientIdentity
,
keyManager
,
UseUPnP
,
OutboundPort
,
MaxPeer
)
if
ShowGenesis
{
if
ShowGenesis
{
...
@@ -75,7 +75,10 @@ func run() error {
...
@@ -75,7 +75,10 @@ func run() error {
utils
.
RegisterInterrupt
(
func
(
os
.
Signal
)
{
utils
.
RegisterInterrupt
(
func
(
os
.
Signal
)
{
gui
.
Stop
()
gui
.
Stop
()
})
})
utils
.
StartEthereum
(
ethereum
,
UseSeed
)
go
utils
.
StartEthereum
(
ethereum
,
UseSeed
)
fmt
.
Println
(
"ETH stack took"
,
time
.
Since
(
tstart
))
// gui blocks the main thread
// gui blocks the main thread
gui
.
Start
(
AssetPath
)
gui
.
Start
(
AssetPath
)
...
...
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