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
91a2275a
Commit
91a2275a
authored
Mar 23, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move RemoteAgent to miner pkg
parent
439481d1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
remote_agent.go
miner/remote_agent.go
+4
-5
xeth.go
xeth/xeth.go
+3
-3
No files found.
xeth/miner
_agent.go
→
miner/remote
_agent.go
View file @
91a2275a
package
xeth
package
miner
import
(
import
(
"github.com/ethereum/ethash"
"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
RemoteAgent
struct
{
type
RemoteAgent
struct
{
...
@@ -13,7 +12,7 @@ type RemoteAgent struct {
...
@@ -13,7 +12,7 @@ type RemoteAgent struct {
quit
chan
struct
{}
quit
chan
struct
{}
workCh
chan
*
types
.
Block
workCh
chan
*
types
.
Block
returnCh
chan
<-
miner
.
Work
returnCh
chan
<-
Work
}
}
func
NewRemoteAgent
()
*
RemoteAgent
{
func
NewRemoteAgent
()
*
RemoteAgent
{
...
@@ -27,7 +26,7 @@ func (a *RemoteAgent) Work() chan<- *types.Block {
...
@@ -27,7 +26,7 @@ func (a *RemoteAgent) Work() chan<- *types.Block {
return
a
.
workCh
return
a
.
workCh
}
}
func
(
a
*
RemoteAgent
)
SetWorkCh
(
returnCh
chan
<-
miner
.
Work
)
{
func
(
a
*
RemoteAgent
)
SetWorkCh
(
returnCh
chan
<-
Work
)
{
a
.
returnCh
=
returnCh
a
.
returnCh
=
returnCh
}
}
...
@@ -74,7 +73,7 @@ func (a *RemoteAgent) SubmitWork(nonce uint64, mixDigest, seedHash common.Hash)
...
@@ -74,7 +73,7 @@ func (a *RemoteAgent) SubmitWork(nonce uint64, mixDigest, seedHash common.Hash)
// 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 @
91a2275a
...
@@ -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
*
RemoteAgent
agent
*
miner
.
RemoteAgent
}
}
// 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
:
NewRemoteAgent
(),
agent
:
miner
.
NewRemoteAgent
(),
}
}
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
()
*
RemoteAgent
{
return
self
.
agent
}
func
(
self
*
XEth
)
RemoteMining
()
*
miner
.
RemoteAgent
{
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