Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Properly store locked coinbase receipt status #2540

Open
wants to merge 1 commit into
base: orchard
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions core/types/receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
var (
receiptStatusFailedRLP = []byte{}
receiptStatusSuccessfulRLP = []byte{0x01}
receiptStatusLockedRLP = []byte{0x02}
)

// This error is returned when a typed receipt is decoded, but the string is empty.
Expand Down Expand Up @@ -183,6 +184,8 @@ func (r *Receipt) setStatus(postStateOrStatus []byte) error {
r.Status = ReceiptStatusSuccessful
case bytes.Equal(postStateOrStatus, receiptStatusFailedRLP):
r.Status = ReceiptStatusFailed
case bytes.Equal(postStateOrStatus, receiptStatusLockedRLP):
r.Status = ReceiptStatusLocked
case len(postStateOrStatus) == len(common.Hash{}):
r.PostState = postStateOrStatus
default:
Expand All @@ -195,6 +198,8 @@ func (r *Receipt) statusEncoding() []byte {
if len(r.PostState) == 0 {
if r.Status == ReceiptStatusFailed {
return receiptStatusFailedRLP
} else if r.Status == ReceiptStatusLocked {
return receiptStatusLockedRLP
}
return receiptStatusSuccessfulRLP
}
Expand Down
Loading