core/types: convert status type from uint to uint64 (#16784)
This commit is contained in:
parent
6ce21a4744
commit
fbf57d53e2
|
@ -12,10 +12,11 @@ import (
|
||||||
|
|
||||||
var _ = (*receiptMarshaling)(nil)
|
var _ = (*receiptMarshaling)(nil)
|
||||||
|
|
||||||
|
// MarshalJSON marshals as JSON.
|
||||||
func (r Receipt) MarshalJSON() ([]byte, error) {
|
func (r Receipt) MarshalJSON() ([]byte, error) {
|
||||||
type Receipt struct {
|
type Receipt struct {
|
||||||
PostState hexutil.Bytes `json:"root"`
|
PostState hexutil.Bytes `json:"root"`
|
||||||
Status hexutil.Uint `json:"status"`
|
Status hexutil.Uint64 `json:"status"`
|
||||||
CumulativeGasUsed hexutil.Uint64 `json:"cumulativeGasUsed" gencodec:"required"`
|
CumulativeGasUsed hexutil.Uint64 `json:"cumulativeGasUsed" gencodec:"required"`
|
||||||
Bloom Bloom `json:"logsBloom" gencodec:"required"`
|
Bloom Bloom `json:"logsBloom" gencodec:"required"`
|
||||||
Logs []*Log `json:"logs" gencodec:"required"`
|
Logs []*Log `json:"logs" gencodec:"required"`
|
||||||
|
@ -25,7 +26,7 @@ func (r Receipt) MarshalJSON() ([]byte, error) {
|
||||||
}
|
}
|
||||||
var enc Receipt
|
var enc Receipt
|
||||||
enc.PostState = r.PostState
|
enc.PostState = r.PostState
|
||||||
enc.Status = hexutil.Uint(r.Status)
|
enc.Status = hexutil.Uint64(r.Status)
|
||||||
enc.CumulativeGasUsed = hexutil.Uint64(r.CumulativeGasUsed)
|
enc.CumulativeGasUsed = hexutil.Uint64(r.CumulativeGasUsed)
|
||||||
enc.Bloom = r.Bloom
|
enc.Bloom = r.Bloom
|
||||||
enc.Logs = r.Logs
|
enc.Logs = r.Logs
|
||||||
|
@ -35,10 +36,11 @@ func (r Receipt) MarshalJSON() ([]byte, error) {
|
||||||
return json.Marshal(&enc)
|
return json.Marshal(&enc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON unmarshals from JSON.
|
||||||
func (r *Receipt) UnmarshalJSON(input []byte) error {
|
func (r *Receipt) UnmarshalJSON(input []byte) error {
|
||||||
type Receipt struct {
|
type Receipt struct {
|
||||||
PostState *hexutil.Bytes `json:"root"`
|
PostState *hexutil.Bytes `json:"root"`
|
||||||
Status *hexutil.Uint `json:"status"`
|
Status *hexutil.Uint64 `json:"status"`
|
||||||
CumulativeGasUsed *hexutil.Uint64 `json:"cumulativeGasUsed" gencodec:"required"`
|
CumulativeGasUsed *hexutil.Uint64 `json:"cumulativeGasUsed" gencodec:"required"`
|
||||||
Bloom *Bloom `json:"logsBloom" gencodec:"required"`
|
Bloom *Bloom `json:"logsBloom" gencodec:"required"`
|
||||||
Logs []*Log `json:"logs" gencodec:"required"`
|
Logs []*Log `json:"logs" gencodec:"required"`
|
||||||
|
@ -54,7 +56,7 @@ func (r *Receipt) UnmarshalJSON(input []byte) error {
|
||||||
r.PostState = *dec.PostState
|
r.PostState = *dec.PostState
|
||||||
}
|
}
|
||||||
if dec.Status != nil {
|
if dec.Status != nil {
|
||||||
r.Status = uint(*dec.Status)
|
r.Status = uint64(*dec.Status)
|
||||||
}
|
}
|
||||||
if dec.CumulativeGasUsed == nil {
|
if dec.CumulativeGasUsed == nil {
|
||||||
return errors.New("missing required field 'cumulativeGasUsed' for Receipt")
|
return errors.New("missing required field 'cumulativeGasUsed' for Receipt")
|
||||||
|
|
|
@ -36,17 +36,17 @@ var (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// ReceiptStatusFailed is the status code of a transaction if execution failed.
|
// ReceiptStatusFailed is the status code of a transaction if execution failed.
|
||||||
ReceiptStatusFailed = uint(0)
|
ReceiptStatusFailed = uint64(0)
|
||||||
|
|
||||||
// ReceiptStatusSuccessful is the status code of a transaction if execution succeeded.
|
// ReceiptStatusSuccessful is the status code of a transaction if execution succeeded.
|
||||||
ReceiptStatusSuccessful = uint(1)
|
ReceiptStatusSuccessful = uint64(1)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Receipt represents the results of a transaction.
|
// Receipt represents the results of a transaction.
|
||||||
type Receipt struct {
|
type Receipt struct {
|
||||||
// Consensus fields
|
// Consensus fields
|
||||||
PostState []byte `json:"root"`
|
PostState []byte `json:"root"`
|
||||||
Status uint `json:"status"`
|
Status uint64 `json:"status"`
|
||||||
CumulativeGasUsed uint64 `json:"cumulativeGasUsed" gencodec:"required"`
|
CumulativeGasUsed uint64 `json:"cumulativeGasUsed" gencodec:"required"`
|
||||||
Bloom Bloom `json:"logsBloom" gencodec:"required"`
|
Bloom Bloom `json:"logsBloom" gencodec:"required"`
|
||||||
Logs []*Log `json:"logs" gencodec:"required"`
|
Logs []*Log `json:"logs" gencodec:"required"`
|
||||||
|
@ -59,7 +59,7 @@ type Receipt struct {
|
||||||
|
|
||||||
type receiptMarshaling struct {
|
type receiptMarshaling struct {
|
||||||
PostState hexutil.Bytes
|
PostState hexutil.Bytes
|
||||||
Status hexutil.Uint
|
Status hexutil.Uint64
|
||||||
CumulativeGasUsed hexutil.Uint64
|
CumulativeGasUsed hexutil.Uint64
|
||||||
GasUsed hexutil.Uint64
|
GasUsed hexutil.Uint64
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue