throw-evm-err-for-pre-exec

This commit is contained in:
linhaiyang 2021-06-17 14:49:09 +08:00
parent c6f166ff6e
commit 97516f7ffd
3 changed files with 3 additions and 2 deletions

View file

@ -110,7 +110,7 @@ func applyTransaction(msg types.Message, config *params.ChainConfig, bc ChainCon
// Create a new receipt for the transaction, storing the intermediate root and gas used // Create a new receipt for the transaction, storing the intermediate root and gas used
// by the tx. // by the tx.
receipt := &types.Receipt{Type: tx.Type(), PostState: root, CumulativeGasUsed: *usedGas} receipt := &types.Receipt{Type: tx.Type(), PostState: root, CumulativeGasUsed: *usedGas, Err: result.Err}
if result.Failed() { if result.Failed() {
receipt.Status = types.ReceiptStatusFailed receipt.Status = types.ReceiptStatusFailed
} else { } else {

View file

@ -70,6 +70,7 @@ type Receipt struct {
BlockHash common.Hash `json:"blockHash,omitempty"` BlockHash common.Hash `json:"blockHash,omitempty"`
BlockNumber *big.Int `json:"blockNumber,omitempty"` BlockNumber *big.Int `json:"blockNumber,omitempty"`
TransactionIndex uint `json:"transactionIndex"` TransactionIndex uint `json:"transactionIndex"`
Err error `json:"error"`
} }
type receiptMarshaling struct { type receiptMarshaling struct {

View file

@ -135,7 +135,7 @@ func (api *PreExecAPI) GetLogs(ctx context.Context, origin *PreExecTx) (*types.R
if err != nil { if err != nil {
return nil, err return nil, err
} }
return receipt, nil return receipt, receipt.Err
} }
// TraceTransaction tracing pre-exec transaction object. // TraceTransaction tracing pre-exec transaction object.