mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
update receipt type sturct for adding fields of From, To, RevertReason, then we can get these fields after eth_getTransactionReceipt called.
Signed-off-by: yjwxfq <yjwxfq@163.com>
This commit is contained in:
parent
2f66d7c47c
commit
2f9b85a51b
2 changed files with 21 additions and 0 deletions
|
|
@ -19,6 +19,9 @@ func (r Receipt) MarshalJSON() ([]byte, error) {
|
||||||
Type hexutil.Uint64 `json:"type,omitempty"`
|
Type hexutil.Uint64 `json:"type,omitempty"`
|
||||||
PostState hexutil.Bytes `json:"root"`
|
PostState hexutil.Bytes `json:"root"`
|
||||||
Status hexutil.Uint64 `json:"status"`
|
Status hexutil.Uint64 `json:"status"`
|
||||||
|
From common.Address `json:"from"`
|
||||||
|
To common.Address `json:"to"`
|
||||||
|
RevertReason string `json:"revertReason"`
|
||||||
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"`
|
||||||
|
|
@ -36,6 +39,9 @@ func (r Receipt) MarshalJSON() ([]byte, error) {
|
||||||
enc.Type = hexutil.Uint64(r.Type)
|
enc.Type = hexutil.Uint64(r.Type)
|
||||||
enc.PostState = r.PostState
|
enc.PostState = r.PostState
|
||||||
enc.Status = hexutil.Uint64(r.Status)
|
enc.Status = hexutil.Uint64(r.Status)
|
||||||
|
enc.From = r.From
|
||||||
|
enc.To = r.To
|
||||||
|
enc.RevertReason = r.RevertReason
|
||||||
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
|
||||||
|
|
@ -57,6 +63,9 @@ func (r *Receipt) UnmarshalJSON(input []byte) error {
|
||||||
Type *hexutil.Uint64 `json:"type,omitempty"`
|
Type *hexutil.Uint64 `json:"type,omitempty"`
|
||||||
PostState *hexutil.Bytes `json:"root"`
|
PostState *hexutil.Bytes `json:"root"`
|
||||||
Status *hexutil.Uint64 `json:"status"`
|
Status *hexutil.Uint64 `json:"status"`
|
||||||
|
From *common.Address `json:"from"`
|
||||||
|
To *common.Address `json:"to"`
|
||||||
|
RevertReason *string `json:"revertReason"`
|
||||||
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"`
|
||||||
|
|
@ -83,6 +92,15 @@ func (r *Receipt) UnmarshalJSON(input []byte) error {
|
||||||
if dec.Status != nil {
|
if dec.Status != nil {
|
||||||
r.Status = uint64(*dec.Status)
|
r.Status = uint64(*dec.Status)
|
||||||
}
|
}
|
||||||
|
if dec.From != nil {
|
||||||
|
r.From = *dec.From
|
||||||
|
}
|
||||||
|
if dec.To != nil {
|
||||||
|
r.To = *dec.To
|
||||||
|
}
|
||||||
|
if dec.RevertReason != nil {
|
||||||
|
r.RevertReason = *dec.RevertReason
|
||||||
|
}
|
||||||
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")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,9 @@ type Receipt struct {
|
||||||
Type uint8 `json:"type,omitempty"`
|
Type uint8 `json:"type,omitempty"`
|
||||||
PostState []byte `json:"root"`
|
PostState []byte `json:"root"`
|
||||||
Status uint64 `json:"status"`
|
Status uint64 `json:"status"`
|
||||||
|
From common.Address `json:"from"`
|
||||||
|
To common.Address `json:"to"`
|
||||||
|
RevertReason string `json:"revertReason"`
|
||||||
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"`
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue