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
a1b4547a
Commit
a1b4547a
authored
Feb 05, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set uncles regardless of empty uncle list. Fixes invalid blocks being mined
parent
57f95c1d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
+4
-5
miner.go
miner/miner.go
+1
-3
pow.go
pow/ezp/pow.go
+3
-2
No files found.
miner/miner.go
View file @
a1b4547a
...
...
@@ -184,9 +184,7 @@ func (self *Miner) mine() {
block
.
Header
()
.
Extra
=
self
.
Extra
// Apply uncles
if
len
(
self
.
uncles
)
>
0
{
block
.
SetUncles
(
self
.
uncles
)
}
block
.
SetUncles
(
self
.
uncles
)
parent
:=
chainMan
.
GetBlock
(
block
.
ParentHash
())
coinbase
:=
state
.
GetOrNewStateObject
(
block
.
Coinbase
())
...
...
pow/ezp/pow.go
View file @
a1b4547a
package
ezp
import
(
"fmt"
"math/big"
"math/rand"
"time"
...
...
@@ -53,13 +54,13 @@ func (pow *EasyPow) Search(block pow.Block, stop <-chan struct{}) []byte {
elapsed
:=
time
.
Now
()
.
UnixNano
()
-
start
hashes
:=
((
float64
(
1e9
)
/
float64
(
elapsed
))
*
float64
(
i
))
/
1000
pow
.
HashRate
=
int64
(
hashes
)
//powlogger.Infoln("Hashing @", pow.HashRate, "khash")
t
=
time
.
Now
()
}
sha
:=
crypto
.
Sha3
(
big
.
NewInt
(
r
.
Int63
())
.
Bytes
())
if
verify
(
hash
,
diff
,
sha
)
{
fmt
.
Printf
(
"HASH: %x
\n
DIFF %v
\n
SHA %x
\n
"
,
hash
,
diff
,
sha
)
return
sha
}
}
...
...
@@ -83,7 +84,7 @@ func verify(hash []byte, diff *big.Int, nonce []byte) bool {
sha
.
Write
(
d
)
verification
:=
new
(
big
.
Int
)
.
Div
(
ethutil
.
BigPow
(
2
,
256
),
diff
)
res
:=
ethutil
.
U256
(
ethutil
.
BigD
(
sha
.
Sum
(
nil
)
))
res
:=
ethutil
.
BigD
(
sha
.
Sum
(
nil
))
return
res
.
Cmp
(
verification
)
<=
0
}
...
...
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