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
732573ba
Commit
732573ba
authored
Aug 21, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turbo mining
parent
854d6d4e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
3 deletions
+15
-3
dagger.go
ethchain/dagger.go
+6
-2
genesis.go
ethchain/genesis.go
+1
-1
miner.go
ethminer/miner.go
+8
-0
No files found.
ethchain/dagger.go
View file @
732573ba
...
@@ -42,6 +42,7 @@ func (pow *EasyPow) Search(block *Block, reactChan chan ethreact.Event) []byte {
...
@@ -42,6 +42,7 @@ func (pow *EasyPow) Search(block *Block, reactChan chan ethreact.Event) []byte {
diff
:=
block
.
Difficulty
diff
:=
block
.
Difficulty
i
:=
int64
(
0
)
i
:=
int64
(
0
)
start
:=
time
.
Now
()
.
UnixNano
()
start
:=
time
.
Now
()
.
UnixNano
()
t
:=
time
.
Now
()
for
{
for
{
select
{
select
{
...
@@ -50,11 +51,14 @@ func (pow *EasyPow) Search(block *Block, reactChan chan ethreact.Event) []byte {
...
@@ -50,11 +51,14 @@ func (pow *EasyPow) Search(block *Block, reactChan chan ethreact.Event) []byte {
return
nil
return
nil
default
:
default
:
i
++
i
++
if
i
%
1234567
==
0
{
if
time
.
Since
(
t
)
>
(
1
*
time
.
Second
)
{
elapsed
:=
time
.
Now
()
.
UnixNano
()
-
start
elapsed
:=
time
.
Now
()
.
UnixNano
()
-
start
hashes
:=
((
float64
(
1e9
)
/
float64
(
elapsed
))
*
float64
(
i
))
/
1000
hashes
:=
((
float64
(
1e9
)
/
float64
(
elapsed
))
*
float64
(
i
))
/
1000
pow
.
HashRate
=
int64
(
hashes
)
pow
.
HashRate
=
int64
(
hashes
)
powlogger
.
Infoln
(
"Hashing @"
,
int64
(
pow
.
HashRate
),
"khash"
)
powlogger
.
Infoln
(
"Hashing @"
,
int64
(
pow
.
HashRate
),
"khash"
)
t
=
time
.
Now
()
}
}
sha
:=
ethcrypto
.
Sha3Bin
(
big
.
NewInt
(
r
.
Int63
())
.
Bytes
())
sha
:=
ethcrypto
.
Sha3Bin
(
big
.
NewInt
(
r
.
Int63
())
.
Bytes
())
...
@@ -64,7 +68,7 @@ func (pow *EasyPow) Search(block *Block, reactChan chan ethreact.Event) []byte {
...
@@ -64,7 +68,7 @@ func (pow *EasyPow) Search(block *Block, reactChan chan ethreact.Event) []byte {
}
}
if
!
pow
.
turbo
{
if
!
pow
.
turbo
{
time
.
Sleep
(
500
*
time
.
Milli
second
)
time
.
Sleep
(
20
*
time
.
Micro
second
)
}
}
}
}
...
...
ethchain/genesis.go
View file @
732573ba
...
@@ -28,7 +28,7 @@ var GenesisHeader = []interface{}{
...
@@ -28,7 +28,7 @@ var GenesisHeader = []interface{}{
""
,
""
,
// Difficulty
// Difficulty
//ethutil.BigPow(2, 22),
//ethutil.BigPow(2, 22),
big
.
NewInt
(
4096
),
big
.
NewInt
(
131072
),
// Number
// Number
ethutil
.
Big0
,
ethutil
.
Big0
,
// Block minimum gas price
// Block minimum gas price
...
...
ethminer/miner.go
View file @
732573ba
...
@@ -23,6 +23,8 @@ type Miner struct {
...
@@ -23,6 +23,8 @@ type Miner struct {
powChan
chan
[]
byte
powChan
chan
[]
byte
powQuitChan
chan
ethreact
.
Event
powQuitChan
chan
ethreact
.
Event
quitChan
chan
chan
error
quitChan
chan
chan
error
turbo
bool
}
}
func
(
self
*
Miner
)
GetPow
()
ethchain
.
PoW
{
func
(
self
*
Miner
)
GetPow
()
ethchain
.
PoW
{
...
@@ -39,6 +41,12 @@ func NewDefaultMiner(coinbase []byte, ethereum ethchain.EthManager) *Miner {
...
@@ -39,6 +41,12 @@ func NewDefaultMiner(coinbase []byte, ethereum ethchain.EthManager) *Miner {
return
&
miner
return
&
miner
}
}
func
(
self
*
Miner
)
ToggleTurbo
()
{
self
.
turbo
=
!
self
.
turbo
self
.
pow
.
Turbo
(
self
.
turbo
)
}
func
(
miner
*
Miner
)
Start
()
{
func
(
miner
*
Miner
)
Start
()
{
miner
.
reactChan
=
make
(
chan
ethreact
.
Event
,
1
)
// This is the channel that receives 'updates' when ever a new transaction or block comes in
miner
.
reactChan
=
make
(
chan
ethreact
.
Event
,
1
)
// This is the channel that receives 'updates' when ever a new transaction or block comes in
miner
.
powChan
=
make
(
chan
[]
byte
,
1
)
// This is the channel that receives valid sha hashes for a given block
miner
.
powChan
=
make
(
chan
[]
byte
,
1
)
// This is the channel that receives valid sha hashes for a given block
...
...
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