Merge pull request #10 from DeBankDeFi/throw-evm-err-for-pre-exec

throw-evm-err-for-pre-exec
This commit is contained in:
sunny 2021-06-17 14:50:21 +08:00 committed by GitHub
commit 7dd4bad747
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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
// 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() {
receipt.Status = types.ReceiptStatusFailed
} else {

View file

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

View file

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