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
38592a13
Commit
38592a13
authored
Nov 26, 2018
by
Jaynti Kanani
Committed by
Martin Holst Swende
Nov 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix mixHash/nonce for parity compatible network (#18166)
parent
2a113f6d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
block.go
core/types/block.go
+2
-2
gen_header_json.go
core/types/gen_header_json.go
+10
-10
No files found.
core/types/block.go
View file @
38592a13
...
...
@@ -81,8 +81,8 @@ type Header struct {
GasUsed
uint64
`json:"gasUsed" gencodec:"required"`
Time
*
big
.
Int
`json:"timestamp" gencodec:"required"`
Extra
[]
byte
`json:"extraData" gencodec:"required"`
MixDigest
common
.
Hash
`json:"mixHash"
gencodec:"required"
`
Nonce
BlockNonce
`json:"nonce"
gencodec:"required"
`
MixDigest
common
.
Hash
`json:"mixHash"`
Nonce
BlockNonce
`json:"nonce"`
}
// field type overrides for gencodec
...
...
core/types/gen_header_json.go
View file @
38592a13
...
...
@@ -13,6 +13,7 @@ import (
var
_
=
(
*
headerMarshaling
)(
nil
)
// MarshalJSON marshals as JSON.
func
(
h
Header
)
MarshalJSON
()
([]
byte
,
error
)
{
type
Header
struct
{
ParentHash
common
.
Hash
`json:"parentHash" gencodec:"required"`
...
...
@@ -28,8 +29,8 @@ func (h Header) MarshalJSON() ([]byte, error) {
GasUsed
hexutil
.
Uint64
`json:"gasUsed" gencodec:"required"`
Time
*
hexutil
.
Big
`json:"timestamp" gencodec:"required"`
Extra
hexutil
.
Bytes
`json:"extraData" gencodec:"required"`
MixDigest
common
.
Hash
`json:"mixHash"
gencodec:"required"
`
Nonce
BlockNonce
`json:"nonce"
gencodec:"required"
`
MixDigest
common
.
Hash
`json:"mixHash"`
Nonce
BlockNonce
`json:"nonce"`
Hash
common
.
Hash
`json:"hash"`
}
var
enc
Header
...
...
@@ -52,6 +53,7 @@ func (h Header) MarshalJSON() ([]byte, error) {
return
json
.
Marshal
(
&
enc
)
}
// UnmarshalJSON unmarshals from JSON.
func
(
h
*
Header
)
UnmarshalJSON
(
input
[]
byte
)
error
{
type
Header
struct
{
ParentHash
*
common
.
Hash
`json:"parentHash" gencodec:"required"`
...
...
@@ -67,8 +69,8 @@ func (h *Header) UnmarshalJSON(input []byte) error {
GasUsed
*
hexutil
.
Uint64
`json:"gasUsed" gencodec:"required"`
Time
*
hexutil
.
Big
`json:"timestamp" gencodec:"required"`
Extra
*
hexutil
.
Bytes
`json:"extraData" gencodec:"required"`
MixDigest
*
common
.
Hash
`json:"mixHash"
gencodec:"required"
`
Nonce
*
BlockNonce
`json:"nonce"
gencodec:"required"
`
MixDigest
*
common
.
Hash
`json:"mixHash"`
Nonce
*
BlockNonce
`json:"nonce"`
}
var
dec
Header
if
err
:=
json
.
Unmarshal
(
input
,
&
dec
);
err
!=
nil
{
...
...
@@ -126,13 +128,11 @@ func (h *Header) UnmarshalJSON(input []byte) error {
return
errors
.
New
(
"missing required field 'extraData' for Header"
)
}
h
.
Extra
=
*
dec
.
Extra
if
dec
.
MixDigest
=
=
nil
{
return
errors
.
New
(
"missing required field 'mixHash' for Header"
)
if
dec
.
MixDigest
!
=
nil
{
h
.
MixDigest
=
*
dec
.
MixDigest
}
h
.
MixDigest
=
*
dec
.
MixDigest
if
dec
.
Nonce
==
nil
{
return
errors
.
New
(
"missing required field 'nonce' for Header"
)
if
dec
.
Nonce
!=
nil
{
h
.
Nonce
=
*
dec
.
Nonce
}
h
.
Nonce
=
*
dec
.
Nonce
return
nil
}
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