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
439481d1
Commit
439481d1
authored
Mar 23, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename Agent to RemoteAgent
parent
01c0ba22
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
miner_agent.go
xeth/miner_agent.go
+11
-11
xeth.go
xeth/xeth.go
+3
-3
No files found.
xeth/miner_agent.go
View file @
439481d1
...
...
@@ -7,7 +7,7 @@ import (
"github.com/ethereum/go-ethereum/miner"
)
type
Agent
struct
{
type
Remote
Agent
struct
{
work
*
types
.
Block
currentWork
*
types
.
Block
...
...
@@ -16,34 +16,34 @@ type Agent struct {
returnCh
chan
<-
miner
.
Work
}
func
New
Agent
()
*
Agent
{
agent
:=
&
Agent
{}
func
New
RemoteAgent
()
*
Remote
Agent
{
agent
:=
&
Remote
Agent
{}
go
agent
.
run
()
return
agent
}
func
(
a
*
Agent
)
Work
()
chan
<-
*
types
.
Block
{
func
(
a
*
Remote
Agent
)
Work
()
chan
<-
*
types
.
Block
{
return
a
.
workCh
}
func
(
a
*
Agent
)
SetWorkCh
(
returnCh
chan
<-
miner
.
Work
)
{
func
(
a
*
Remote
Agent
)
SetWorkCh
(
returnCh
chan
<-
miner
.
Work
)
{
a
.
returnCh
=
returnCh
}
func
(
a
*
Agent
)
Start
()
{
func
(
a
*
Remote
Agent
)
Start
()
{
a
.
quit
=
make
(
chan
struct
{})
a
.
workCh
=
make
(
chan
*
types
.
Block
,
1
)
}
func
(
a
*
Agent
)
Stop
()
{
func
(
a
*
Remote
Agent
)
Stop
()
{
close
(
a
.
quit
)
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
:
for
{
select
{
...
...
@@ -55,7 +55,7 @@ out:
}
}
func
(
a
*
Agent
)
GetWork
()
[
3
]
string
{
func
(
a
*
Remote
Agent
)
GetWork
()
[
3
]
string
{
var
res
[
3
]
string
// XXX Wait here until work != nil ?
...
...
@@ -69,7 +69,7 @@ func (a *Agent) GetWork() [3]string {
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
// Make sure the external miner was working on the right hash
...
...
xeth/xeth.go
View file @
439481d1
...
...
@@ -102,7 +102,7 @@ type XEth struct {
// register map[string][]*interface{} // TODO improve return type
// Miner agent
agent
*
Agent
agent
*
Remote
Agent
}
// New creates an XEth that uses the given frontend.
...
...
@@ -120,7 +120,7 @@ func New(eth Backend, frontend Frontend) *XEth {
frontend
:
frontend
,
logs
:
make
(
map
[
int
]
*
logFilter
),
messages
:
make
(
map
[
int
]
*
whisperFilter
),
agent
:
NewAgent
(),
agent
:
New
Remote
Agent
(),
}
eth
.
Miner
()
.
Register
(
xeth
.
agent
)
...
...
@@ -170,7 +170,7 @@ func (self *XEth) stop() {
func
(
self
*
XEth
)
DefaultGas
()
*
big
.
Int
{
return
defaultGas
}
func
(
self
*
XEth
)
DefaultGasPrice
()
*
big
.
Int
{
return
defaultGasPrice
}
func
(
self
*
XEth
)
RemoteMining
()
*
Agent
{
return
self
.
agent
}
func
(
self
*
XEth
)
RemoteMining
()
*
Remote
Agent
{
return
self
.
agent
}
func
(
self
*
XEth
)
AtStateNum
(
num
int64
)
*
XEth
{
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