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
6657d544
Commit
6657d544
authored
Mar 23, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of github.com-obscure:ethereum/go-ethereum into develop
parents
0be6d340
dbb2af60
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
94 additions
and
13 deletions
+94
-13
bindings.go
cmd/mist/bindings.go
+1
-1
gui.go
cmd/mist/gui.go
+6
-5
html_container.go
cmd/mist/html_container.go
+2
-2
qml_container.go
cmd/mist/qml_container.go
+1
-2
remote_agent.go
miner/remote_agent.go
+81
-0
xeth.go
xeth/xeth.go
+3
-3
No files found.
cmd/mist/bindings.go
View file @
6657d544
...
@@ -67,7 +67,7 @@ func (self *Gui) DumpState(hash, path string) {
...
@@ -67,7 +67,7 @@ func (self *Gui) DumpState(hash, path string) {
i
,
_
:=
strconv
.
Atoi
(
hash
[
1
:
])
i
,
_
:=
strconv
.
Atoi
(
hash
[
1
:
])
block
=
self
.
eth
.
ChainManager
()
.
GetBlockByNumber
(
uint64
(
i
))
block
=
self
.
eth
.
ChainManager
()
.
GetBlockByNumber
(
uint64
(
i
))
}
else
{
}
else
{
block
=
self
.
eth
.
ChainManager
()
.
GetBlock
(
common
.
Hex
2Bytes
(
hash
))
block
=
self
.
eth
.
ChainManager
()
.
GetBlock
(
common
.
Hex
ToHash
(
hash
))
}
}
if
block
==
nil
{
if
block
==
nil
{
...
...
cmd/mist/gui.go
View file @
6657d544
...
@@ -31,11 +31,11 @@ import (
...
@@ -31,11 +31,11 @@ import (
"sort"
"sort"
"time"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/ui/qt/qwhisper"
"github.com/ethereum/go-ethereum/ui/qt/qwhisper"
"github.com/ethereum/go-ethereum/xeth"
"github.com/ethereum/go-ethereum/xeth"
...
@@ -230,7 +230,8 @@ func (self *Gui) loadMergedMiningOptions() {
...
@@ -230,7 +230,8 @@ func (self *Gui) loadMergedMiningOptions() {
func
(
gui
*
Gui
)
insertTransaction
(
window
string
,
tx
*
types
.
Transaction
)
{
func
(
gui
*
Gui
)
insertTransaction
(
window
string
,
tx
*
types
.
Transaction
)
{
var
inout
string
var
inout
string
if
gui
.
eth
.
AccountManager
()
.
HasAccount
(
tx
.
From
())
{
from
,
_
:=
tx
.
From
()
if
gui
.
eth
.
AccountManager
()
.
HasAccount
(
common
.
Hex2Bytes
(
from
.
Hex
()))
{
inout
=
"send"
inout
=
"send"
}
else
{
}
else
{
inout
=
"recv"
inout
=
"recv"
...
@@ -238,8 +239,8 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) {
...
@@ -238,8 +239,8 @@ func (gui *Gui) insertTransaction(window string, tx *types.Transaction) {
var
(
var
(
ptx
=
xeth
.
NewTx
(
tx
)
ptx
=
xeth
.
NewTx
(
tx
)
send
=
common
.
Bytes2Hex
(
tx
.
From
()
)
send
=
from
.
Hex
(
)
rec
=
common
.
Bytes2Hex
(
tx
.
To
()
)
rec
=
tx
.
To
()
.
Hex
(
)
)
)
ptx
.
Sender
=
send
ptx
.
Sender
=
send
ptx
.
Address
=
rec
ptx
.
Address
=
rec
...
@@ -263,7 +264,7 @@ func (gui *Gui) readPreviousTransactions() {
...
@@ -263,7 +264,7 @@ func (gui *Gui) readPreviousTransactions() {
}
}
func
(
gui
*
Gui
)
processBlock
(
block
*
types
.
Block
,
initial
bool
)
{
func
(
gui
*
Gui
)
processBlock
(
block
*
types
.
Block
,
initial
bool
)
{
name
:=
common
.
Bytes2Hex
(
block
.
Coinbase
()
)
name
:=
block
.
Coinbase
()
.
Hex
(
)
b
:=
xeth
.
NewBlock
(
block
)
b
:=
xeth
.
NewBlock
(
block
)
b
.
Name
=
name
b
.
Name
=
name
...
...
cmd/mist/html_container.go
View file @
6657d544
...
@@ -29,8 +29,8 @@ import (
...
@@ -29,8 +29,8 @@ import (
"path"
"path"
"path/filepath"
"path/filepath"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/xeth"
"github.com/ethereum/go-ethereum/xeth"
"github.com/howeyc/fsnotify"
"github.com/howeyc/fsnotify"
"github.com/obscuren/qml"
"github.com/obscuren/qml"
...
@@ -139,7 +139,7 @@ func (app *HtmlApplication) Window() *qml.Window {
...
@@ -139,7 +139,7 @@ func (app *HtmlApplication) Window() *qml.Window {
}
}
func
(
app
*
HtmlApplication
)
NewBlock
(
block
*
types
.
Block
)
{
func
(
app
*
HtmlApplication
)
NewBlock
(
block
*
types
.
Block
)
{
b
:=
&
xeth
.
Block
{
Number
:
int
(
block
.
NumberU64
()),
Hash
:
common
.
Bytes2Hex
(
block
.
Hash
()
)}
b
:=
&
xeth
.
Block
{
Number
:
int
(
block
.
NumberU64
()),
Hash
:
block
.
Hash
()
.
Hex
(
)}
app
.
webView
.
Call
(
"onNewBlockCb"
,
b
)
app
.
webView
.
Call
(
"onNewBlockCb"
,
b
)
}
}
...
...
cmd/mist/qml_container.go
View file @
6657d544
...
@@ -25,7 +25,6 @@ import (
...
@@ -25,7 +25,6 @@ import (
"runtime"
"runtime"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/xeth"
"github.com/ethereum/go-ethereum/xeth"
"github.com/obscuren/qml"
"github.com/obscuren/qml"
)
)
...
@@ -68,7 +67,7 @@ func (app *QmlApplication) NewWatcher(quitChan chan bool) {
...
@@ -68,7 +67,7 @@ func (app *QmlApplication) NewWatcher(quitChan chan bool) {
// Events
// Events
func
(
app
*
QmlApplication
)
NewBlock
(
block
*
types
.
Block
)
{
func
(
app
*
QmlApplication
)
NewBlock
(
block
*
types
.
Block
)
{
pblock
:=
&
xeth
.
Block
{
Number
:
int
(
block
.
NumberU64
()),
Hash
:
common
.
Bytes2Hex
(
block
.
Hash
()
)}
pblock
:=
&
xeth
.
Block
{
Number
:
int
(
block
.
NumberU64
()),
Hash
:
block
.
Hash
()
.
Hex
(
)}
app
.
win
.
Call
(
"onNewBlockCb"
,
pblock
)
app
.
win
.
Call
(
"onNewBlockCb"
,
pblock
)
}
}
...
...
xeth/miner
_agent.go
→
miner/remote
_agent.go
View file @
6657d544
package
xeth
package
miner
import
(
import
(
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/miner"
)
)
type
Agent
struct
{
type
Remote
Agent
struct
{
work
*
types
.
Block
work
*
types
.
Block
currentWork
*
types
.
Block
currentWork
*
types
.
Block
quit
chan
struct
{}
quit
chan
struct
{}
workCh
chan
*
types
.
Block
workCh
chan
*
types
.
Block
returnCh
chan
<-
miner
.
Work
returnCh
chan
<-
Work
}
}
func
New
Agent
()
*
Agent
{
func
New
RemoteAgent
()
*
Remote
Agent
{
agent
:=
&
Agent
{}
agent
:=
&
Remote
Agent
{}
go
agent
.
run
()
go
agent
.
run
()
return
agent
return
agent
}
}
func
(
a
*
Agent
)
Work
()
chan
<-
*
types
.
Block
{
func
(
a
*
Remote
Agent
)
Work
()
chan
<-
*
types
.
Block
{
return
a
.
workCh
return
a
.
workCh
}
}
func
(
a
*
Agent
)
SetWorkCh
(
returnCh
chan
<-
miner
.
Work
)
{
func
(
a
*
RemoteAgent
)
SetWorkCh
(
returnCh
chan
<-
Work
)
{
a
.
returnCh
=
returnCh
a
.
returnCh
=
returnCh
}
}
func
(
a
*
Agent
)
Start
()
{
func
(
a
*
Remote
Agent
)
Start
()
{
a
.
quit
=
make
(
chan
struct
{})
a
.
quit
=
make
(
chan
struct
{})
a
.
workCh
=
make
(
chan
*
types
.
Block
,
1
)
a
.
workCh
=
make
(
chan
*
types
.
Block
,
1
)
}
}
func
(
a
*
Agent
)
Stop
()
{
func
(
a
*
Remote
Agent
)
Stop
()
{
close
(
a
.
quit
)
close
(
a
.
quit
)
close
(
a
.
workCh
)
close
(
a
.
workCh
)
}
}
func
(
a
*
Agent
)
GetHashRate
()
int64
{
return
0
}
func
(
a
*
Remote
Agent
)
GetHashRate
()
int64
{
return
0
}
func
(
a
*
Agent
)
run
()
{
func
(
a
*
Remote
Agent
)
run
()
{
out
:
out
:
for
{
for
{
select
{
select
{
...
@@ -54,26 +54,26 @@ out:
...
@@ -54,26 +54,26 @@ out:
}
}
}
}
func
(
a
*
Agent
)
GetWork
()
[
3
]
string
{
func
(
a
*
RemoteAgent
)
GetWork
()
[
3
]
string
{
// TODO return HashNoNonce, DAGSeedHash, Difficulty
var
res
[
3
]
string
var
res
[
3
]
string
// XXX Wait here until
l work != nil ?.
// XXX Wait here until
work != nil ?
if
a
.
work
!=
nil
{
if
a
.
work
!=
nil
{
res
[
0
]
=
a
.
work
.
HashNoNonce
()
.
Hex
()
// Header Hash No Nonce
res
[
0
]
=
a
.
work
.
HashNoNonce
()
.
Hex
()
res
[
1
]
=
common
.
Hash
{}
.
Hex
()
// DAG Seed
seedHash
,
_
:=
ethash
.
GetSeedHash
(
a
.
currentWork
.
NumberU64
())
res
[
2
]
=
common
.
Hash
{}
.
Hex
()
// Difficulty
res
[
1
]
=
common
.
Bytes2Hex
(
seedHash
)
res
[
2
]
=
common
.
Bytes2Hex
(
a
.
work
.
Difficulty
()
.
Bytes
())
}
}
return
res
return
res
}
}
func
(
a
*
Agent
)
SubmitWork
(
nonce
uint64
,
mixDigest
,
seedHash
common
.
Hash
)
bool
{
func
(
a
*
Remote
Agent
)
SubmitWork
(
nonce
uint64
,
mixDigest
,
seedHash
common
.
Hash
)
bool
{
// Return true or false, but does not indicate if the PoW was correct
// Return true or false, but does not indicate if the PoW was correct
// Make sure the external miner was working on the right hash
// Make sure the external miner was working on the right hash
if
a
.
currentWork
!=
nil
&&
a
.
work
!=
nil
&&
a
.
currentWork
.
Hash
()
==
a
.
work
.
Hash
()
{
if
a
.
currentWork
!=
nil
&&
a
.
work
!=
nil
&&
a
.
currentWork
.
Hash
()
==
a
.
work
.
Hash
()
{
a
.
returnCh
<-
miner
.
Work
{
a
.
currentWork
.
Number
()
.
Uint64
(),
nonce
,
mixDigest
.
Bytes
(),
seedHash
.
Bytes
()}
a
.
returnCh
<-
Work
{
a
.
currentWork
.
Number
()
.
Uint64
(),
nonce
,
mixDigest
.
Bytes
(),
seedHash
.
Bytes
()}
return
true
return
true
}
}
...
...
xeth/xeth.go
View file @
6657d544
...
@@ -102,7 +102,7 @@ type XEth struct {
...
@@ -102,7 +102,7 @@ type XEth struct {
// register map[string][]*interface{} // TODO improve return type
// register map[string][]*interface{} // TODO improve return type
// Miner agent
// Miner agent
agent
*
Agent
agent
*
miner
.
Remote
Agent
}
}
// New creates an XEth that uses the given frontend.
// New creates an XEth that uses the given frontend.
...
@@ -120,7 +120,7 @@ func New(eth Backend, frontend Frontend) *XEth {
...
@@ -120,7 +120,7 @@ func New(eth Backend, frontend Frontend) *XEth {
frontend
:
frontend
,
frontend
:
frontend
,
logs
:
make
(
map
[
int
]
*
logFilter
),
logs
:
make
(
map
[
int
]
*
logFilter
),
messages
:
make
(
map
[
int
]
*
whisperFilter
),
messages
:
make
(
map
[
int
]
*
whisperFilter
),
agent
:
New
Agent
(),
agent
:
miner
.
NewRemote
Agent
(),
}
}
eth
.
Miner
()
.
Register
(
xeth
.
agent
)
eth
.
Miner
()
.
Register
(
xeth
.
agent
)
...
@@ -170,7 +170,7 @@ func (self *XEth) stop() {
...
@@ -170,7 +170,7 @@ func (self *XEth) stop() {
func
(
self
*
XEth
)
DefaultGas
()
*
big
.
Int
{
return
defaultGas
}
func
(
self
*
XEth
)
DefaultGas
()
*
big
.
Int
{
return
defaultGas
}
func
(
self
*
XEth
)
DefaultGasPrice
()
*
big
.
Int
{
return
defaultGasPrice
}
func
(
self
*
XEth
)
DefaultGasPrice
()
*
big
.
Int
{
return
defaultGasPrice
}
func
(
self
*
XEth
)
RemoteMining
()
*
Agent
{
return
self
.
agent
}
func
(
self
*
XEth
)
RemoteMining
()
*
miner
.
Remote
Agent
{
return
self
.
agent
}
func
(
self
*
XEth
)
AtStateNum
(
num
int64
)
*
XEth
{
func
(
self
*
XEth
)
AtStateNum
(
num
int64
)
*
XEth
{
chain
:=
self
.
Backend
()
.
ChainManager
()
chain
:=
self
.
Backend
()
.
ChainManager
()
...
...
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