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
8653db6d
Commit
8653db6d
authored
Feb 27, 2015
by
Matthew Wampler-Doty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introducign MixDigest and SeedHash
parent
5912f0a8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
4 deletions
+9
-4
block.go
core/types/block.go
+7
-2
block.go
pow/block.go
+1
-1
pow.go
pow/ezp/pow.go
+1
-1
No files found.
core/types/block.go
View file @
8653db6d
...
...
@@ -41,12 +41,16 @@ type Header struct {
Extra
string
// Block Nonce for verification
Nonce
ethutil
.
Bytes
// Mix digest for quick checking to prevent DOS
MixDigest
ethutil
.
Bytes
// SeedHash used for light client verification
SeedHash
ethutil
.
Bytes
}
func
(
self
*
Header
)
rlpData
(
withNonce
bool
)
[]
interface
{}
{
fields
:=
[]
interface
{}{
self
.
ParentHash
,
self
.
UncleHash
,
self
.
Coinbase
,
self
.
Root
,
self
.
TxHash
,
self
.
ReceiptHash
,
self
.
Bloom
,
self
.
Difficulty
,
self
.
Number
,
self
.
GasLimit
,
self
.
GasUsed
,
self
.
Time
,
self
.
Extra
}
if
withNonce
{
fields
=
append
(
fields
,
self
.
Nonce
)
fields
=
append
(
fields
,
self
.
Nonce
,
self
.
MixDigest
,
self
.
SeedHash
)
}
return
fields
...
...
@@ -176,6 +180,8 @@ func (self *Block) RlpDataForStorage() interface{} {
// Header accessors (add as you need them)
func
(
self
*
Block
)
Number
()
*
big
.
Int
{
return
self
.
header
.
Number
}
func
(
self
*
Block
)
NumberU64
()
uint64
{
return
self
.
header
.
Number
.
Uint64
()
}
func
(
self
*
Block
)
MixDigest
()
[]
byte
{
return
self
.
header
.
MixDigest
}
func
(
self
*
Block
)
SeedHash
()
[]
byte
{
return
self
.
header
.
SeedHash
}
func
(
self
*
Block
)
Nonce
()
[]
byte
{
return
self
.
header
.
Nonce
}
func
(
self
*
Block
)
Bloom
()
[]
byte
{
return
self
.
header
.
Bloom
}
func
(
self
*
Block
)
Coinbase
()
[]
byte
{
return
self
.
header
.
Coinbase
}
...
...
@@ -200,7 +206,6 @@ func (self *Block) GetUncle(i int) *Header {
// Implement pow.Block
func
(
self
*
Block
)
Difficulty
()
*
big
.
Int
{
return
self
.
header
.
Difficulty
}
func
(
self
*
Block
)
N
()
[]
byte
{
return
self
.
header
.
Nonce
}
func
(
self
*
Block
)
HashNoNonce
()
[]
byte
{
return
self
.
header
.
HashNoNonce
()
}
func
(
self
*
Block
)
Hash
()
[]
byte
{
...
...
pow/block.go
View file @
8653db6d
...
...
@@ -5,6 +5,6 @@ import "math/big"
type
Block
interface
{
Difficulty
()
*
big
.
Int
HashNoNonce
()
[]
byte
N
()
[]
byte
N
once
()
[]
byte
Number
()
*
big
.
Int
}
pow/ezp/pow.go
View file @
8653db6d
...
...
@@ -96,5 +96,5 @@ func verify(hash []byte, diff *big.Int, nonce []byte) bool {
}
func
Verify
(
block
pow
.
Block
)
bool
{
return
verify
(
block
.
HashNoNonce
(),
block
.
Difficulty
(),
block
.
N
())
return
verify
(
block
.
HashNoNonce
(),
block
.
Difficulty
(),
block
.
N
once
())
}
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