fix: eth: cleanup error cases

1. Return an error on gas estimation failure instead of logging.
2. Return early when processing signed messages on failure instead of
continuing.
This commit is contained in:
Steven Allen 2023-02-17 12:02:00 -08:00
parent 00b6d06041
commit bad41c247a

View File

@ -895,7 +895,7 @@ func (a *EthModule) EthEstimateGas(ctx context.Context, tx ethtypes.EthCall) (et
expectedGas, err := ethGasSearch(ctx, a.Chain, a.Stmgr, a.Mpool, msg, ts)
if err != nil {
log.Errorw("expected gas", "err", err)
return 0, xerrors.Errorf("gas search failed: %w", err)
}
return ethtypes.EthUint64(expectedGas), nil
@ -2157,11 +2157,13 @@ func (m *EthTxHashManager) ProcessSignedMessage(ctx context.Context, msg *types.
ethTx, err := newEthTxFromSignedMessage(ctx, msg, m.StateAPI)
if err != nil {
log.Errorf("error converting filecoin message to eth tx: %s", err)
return
}
err = m.TransactionHashLookup.UpsertHash(ethTx.Hash, msg.Cid())
if err != nil {
log.Errorf("error inserting tx mapping to db: %s", err)
return
}
}