|
|
@ -108,14 +108,21 @@ func (r *Receipt) DecodeRLP(s *rlp.Stream) error { |
|
|
|
} |
|
|
|
} |
|
|
|
// Deserialize based on the first component type.
|
|
|
|
// Deserialize based on the first component type.
|
|
|
|
switch { |
|
|
|
switch { |
|
|
|
case kind == rlp.Byte || kind == rlp.String && len(cnt) == 0: |
|
|
|
case kind == rlp.Byte || (kind == rlp.String && len(cnt) == 0): |
|
|
|
// The first component of metropolis receipts is Byte
|
|
|
|
// The first component of metropolis receipts is Byte (0x01), or the empty
|
|
|
|
// or empty String(byte with 0x00 value).
|
|
|
|
// string (0x80, decoded as a byte with 0x00 value).
|
|
|
|
var metro metropolisReceiptRLP |
|
|
|
var metro metropolisReceiptRLP |
|
|
|
if err := rlp.DecodeBytes(raw, &metro); err != nil { |
|
|
|
if err := rlp.DecodeBytes(raw, &metro); err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
r.Failed = metro.Status == receiptStatusFailed |
|
|
|
switch metro.Status { |
|
|
|
|
|
|
|
case receiptStatusSuccessful: |
|
|
|
|
|
|
|
r.Failed = false |
|
|
|
|
|
|
|
case receiptStatusFailed: |
|
|
|
|
|
|
|
r.Failed = true |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
return fmt.Errorf("invalid status byte: 0x%x", metro.Status) |
|
|
|
|
|
|
|
} |
|
|
|
r.CumulativeGasUsed = metro.CumulativeGasUsed |
|
|
|
r.CumulativeGasUsed = metro.CumulativeGasUsed |
|
|
|
r.Bloom = metro.Bloom |
|
|
|
r.Bloom = metro.Bloom |
|
|
|
r.Logs = metro.Logs |
|
|
|
r.Logs = metro.Logs |
|
|
|