Skip to content

Commit

Permalink
fix/lint (#11131)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhuie19 authored Oct 31, 2023
1 parent 2534e1a commit 943a1ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 4 additions & 4 deletions core/chains/evm/txmgr/evm_tx_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -1486,19 +1486,19 @@ func (o *evmTxStore) UpdateTxUnstartedToInProgress(ctx context.Context, etx *Tx,
// Note: the record of the original abandoned transaction will remain in evm.txes, only the attempt is replaced. (Any receipt
// associated with the abandoned attempt would also be lost, although this shouldn't happen since only unconfirmed transactions
// can be abandoned.)
res, err := tx.Exec(`DELETE FROM evm.tx_attempts a USING evm.txes t
res, err2 := tx.Exec(`DELETE FROM evm.tx_attempts a USING evm.txes t
WHERE t.id = a.eth_tx_id AND a.hash = $1 AND t.state = $2 AND t.error = 'abandoned'`,
attempt.Hash, txmgr.TxFatalError,
)

if err != nil {
if err2 != nil {
// If the DELETE fails, we don't want to abort before at least attempting the INSERT. tx hash conflicts with
// abandoned transactions can only happen after a nonce reset. If the node is operating normally but there is
// some unexpected issue with the DELETE query, blocking the txmgr from sending transactions would be risky
// and could potentially get the node stuck. If the INSERT is going to succeed then we definitely want to continue.
// And even if the INSERT fails, an error message showing the txmgr is having trouble inserting tx's in the db may be
// easier to understand quickly if there is a problem with the node.
o.logger.Errorw("Ignoring unexpected db error while checking for txhash conflict", "err", err)
o.logger.Errorw("Ignoring unexpected db error while checking for txhash conflict", "err", err2)
} else if rows, err := res.RowsAffected(); err != nil {
o.logger.Errorw("Ignoring unexpected db error reading rows affected while checking for txhash conflict", "err", err)
} else if rows > 0 {
Expand All @@ -1511,7 +1511,7 @@ func (o *evmTxStore) UpdateTxUnstartedToInProgress(ctx context.Context, etx *Tx,
if e != nil {
return pkgerrors.Wrap(e, "failed to BindNamed")
}
err = tx.Get(&dbAttempt, query, args...)
err := tx.Get(&dbAttempt, query, args...)
if err != nil {
var pqErr *pgconn.PgError
if isPqErr := errors.As(err, &pqErr); isPqErr &&
Expand Down
3 changes: 0 additions & 3 deletions core/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ const (
DefaultSecretSize = 48
// EVMWordByteLen the length of an EVM Word Byte
EVMWordByteLen = 32

// defaultErrorBufferCap is the default cap on the errors an error buffer can store at any time
defaultErrorBufferCap = 50
)

// ZeroAddress is an address of all zeroes, otherwise in Ethereum as
Expand Down

0 comments on commit 943a1ad

Please sign in to comment.