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
fbf57d53
Commit
fbf57d53
authored
May 23, 2018
by
gary rong
Committed by
Péter Szilágyi
May 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/types: convert status type from uint to uint64 (#16784)
parent
6ce21a47
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
gen_receipt_json.go
core/types/gen_receipt_json.go
+6
-4
receipt.go
core/types/receipt.go
+4
-4
No files found.
core/types/gen_receipt_json.go
View file @
fbf57d53
...
...
@@ -12,10 +12,11 @@ import (
var
_
=
(
*
receiptMarshaling
)(
nil
)
// MarshalJSON marshals as JSON.
func
(
r
Receipt
)
MarshalJSON
()
([]
byte
,
error
)
{
type
Receipt
struct
{
PostState
hexutil
.
Bytes
`json:"root"`
Status
hexutil
.
Uint
`json:"status"`
Status
hexutil
.
Uint
64
`json:"status"`
CumulativeGasUsed
hexutil
.
Uint64
`json:"cumulativeGasUsed" gencodec:"required"`
Bloom
Bloom
`json:"logsBloom" gencodec:"required"`
Logs
[]
*
Log
`json:"logs" gencodec:"required"`
...
...
@@ -25,7 +26,7 @@ func (r Receipt) MarshalJSON() ([]byte, error) {
}
var
enc
Receipt
enc
.
PostState
=
r
.
PostState
enc
.
Status
=
hexutil
.
Uint
(
r
.
Status
)
enc
.
Status
=
hexutil
.
Uint
64
(
r
.
Status
)
enc
.
CumulativeGasUsed
=
hexutil
.
Uint64
(
r
.
CumulativeGasUsed
)
enc
.
Bloom
=
r
.
Bloom
enc
.
Logs
=
r
.
Logs
...
...
@@ -35,10 +36,11 @@ func (r Receipt) MarshalJSON() ([]byte, error) {
return
json
.
Marshal
(
&
enc
)
}
// UnmarshalJSON unmarshals from JSON.
func
(
r
*
Receipt
)
UnmarshalJSON
(
input
[]
byte
)
error
{
type
Receipt
struct
{
PostState
*
hexutil
.
Bytes
`json:"root"`
Status
*
hexutil
.
Uint
`json:"status"`
Status
*
hexutil
.
Uint
64
`json:"status"`
CumulativeGasUsed
*
hexutil
.
Uint64
`json:"cumulativeGasUsed" gencodec:"required"`
Bloom
*
Bloom
`json:"logsBloom" gencodec:"required"`
Logs
[]
*
Log
`json:"logs" gencodec:"required"`
...
...
@@ -54,7 +56,7 @@ func (r *Receipt) UnmarshalJSON(input []byte) error {
r
.
PostState
=
*
dec
.
PostState
}
if
dec
.
Status
!=
nil
{
r
.
Status
=
uint
(
*
dec
.
Status
)
r
.
Status
=
uint
64
(
*
dec
.
Status
)
}
if
dec
.
CumulativeGasUsed
==
nil
{
return
errors
.
New
(
"missing required field 'cumulativeGasUsed' for Receipt"
)
...
...
core/types/receipt.go
View file @
fbf57d53
...
...
@@ -36,17 +36,17 @@ var (
const
(
// ReceiptStatusFailed is the status code of a transaction if execution failed.
ReceiptStatusFailed
=
uint
(
0
)
ReceiptStatusFailed
=
uint
64
(
0
)
// ReceiptStatusSuccessful is the status code of a transaction if execution succeeded.
ReceiptStatusSuccessful
=
uint
(
1
)
ReceiptStatusSuccessful
=
uint
64
(
1
)
)
// Receipt represents the results of a transaction.
type
Receipt
struct
{
// Consensus fields
PostState
[]
byte
`json:"root"`
Status
uint
`json:"status"`
Status
uint
64
`json:"status"`
CumulativeGasUsed
uint64
`json:"cumulativeGasUsed" gencodec:"required"`
Bloom
Bloom
`json:"logsBloom" gencodec:"required"`
Logs
[]
*
Log
`json:"logs" gencodec:"required"`
...
...
@@ -59,7 +59,7 @@ type Receipt struct {
type
receiptMarshaling
struct
{
PostState
hexutil
.
Bytes
Status
hexutil
.
Uint
Status
hexutil
.
Uint
64
CumulativeGasUsed
hexutil
.
Uint64
GasUsed
hexutil
.
Uint64
}
...
...
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