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
dad29bca
Commit
dad29bca
authored
Jul 18, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added channel for starting/stopping miner
parent
65650a5c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
miner.go
ethminer/miner.go
+8
-4
No files found.
ethminer/miner.go
View file @
dad29bca
...
@@ -24,11 +24,11 @@ type Miner struct {
...
@@ -24,11 +24,11 @@ type Miner struct {
quitChan
chan
bool
quitChan
chan
bool
}
}
func
(
self
Miner
)
GetPow
()
*
ethchain
.
PoW
{
func
(
self
*
Miner
)
GetPow
()
ethchain
.
PoW
{
return
&
self
.
pow
return
self
.
pow
}
}
func
NewDefaultMiner
(
coinbase
[]
byte
,
ethereum
ethchain
.
EthManager
)
Miner
{
func
NewDefaultMiner
(
coinbase
[]
byte
,
ethereum
ethchain
.
EthManager
)
*
Miner
{
reactChan
:=
make
(
chan
ethutil
.
React
,
1
)
// This is the channel that receives 'updates' when ever a new transaction or block comes in
reactChan
:=
make
(
chan
ethutil
.
React
,
1
)
// This is the channel that receives 'updates' when ever a new transaction or block comes in
powChan
:=
make
(
chan
[]
byte
,
1
)
// This is the channel that receives valid sha hases for a given block
powChan
:=
make
(
chan
[]
byte
,
1
)
// This is the channel that receives valid sha hases for a given block
powQuitChan
:=
make
(
chan
ethutil
.
React
,
1
)
// This is the channel that can exit the miner thread
powQuitChan
:=
make
(
chan
ethutil
.
React
,
1
)
// This is the channel that can exit the miner thread
...
@@ -59,7 +59,7 @@ func NewDefaultMiner(coinbase []byte, ethereum ethchain.EthManager) Miner {
...
@@ -59,7 +59,7 @@ func NewDefaultMiner(coinbase []byte, ethereum ethchain.EthManager) Miner {
miner
.
txs
=
ethereum
.
TxPool
()
.
Flush
()
miner
.
txs
=
ethereum
.
TxPool
()
.
Flush
()
miner
.
block
=
ethereum
.
BlockChain
()
.
NewBlock
(
miner
.
coinbase
)
miner
.
block
=
ethereum
.
BlockChain
()
.
NewBlock
(
miner
.
coinbase
)
return
miner
return
&
miner
}
}
func
(
miner
*
Miner
)
Start
()
{
func
(
miner
*
Miner
)
Start
()
{
...
@@ -67,6 +67,8 @@ func (miner *Miner) Start() {
...
@@ -67,6 +67,8 @@ func (miner *Miner) Start() {
//miner.ethereum.StateManager().Prepare(miner.block.State(), miner.block.State())
//miner.ethereum.StateManager().Prepare(miner.block.State(), miner.block.State())
go
miner
.
listener
()
go
miner
.
listener
()
logger
.
Infoln
(
"Started"
)
logger
.
Infoln
(
"Started"
)
miner
.
ethereum
.
Reactor
()
.
Post
(
"miner:start"
,
miner
)
}
}
func
(
miner
*
Miner
)
listener
()
{
func
(
miner
*
Miner
)
listener
()
{
...
@@ -137,6 +139,8 @@ func (self *Miner) Stop() {
...
@@ -137,6 +139,8 @@ func (self *Miner) Stop() {
close
(
self
.
powQuitChan
)
close
(
self
.
powQuitChan
)
close
(
self
.
quitChan
)
close
(
self
.
quitChan
)
self
.
ethereum
.
Reactor
()
.
Post
(
"miner:stop"
,
self
)
}
}
func
(
self
*
Miner
)
mineNewBlock
()
{
func
(
self
*
Miner
)
mineNewBlock
()
{
...
...
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