Skip to content

Commit

Permalink
BCI-268: fix distinct query (#8606)
Browse files Browse the repository at this point in the history
Co-authored-by: Prashant Yadav <34992934+prashantkumar1982@users.noreply.github.com>
  • Loading branch information
augustbleeds and prashantkumar1982 authored Mar 2, 2023
1 parent 2cac9ef commit de3c326
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/chains/evm/txmgr/orm.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ func (o *orm) FindEthTxAttemptsRequiringResend(olderThan time.Time, maxInFlightT
// this select distinct works because of unique index on eth_txes
// (evm_chain_id, from_address, nonce)
err = o.q.Select(&attempts, `
SELECT DISTINCT ON (nonce) eth_tx_attempts.*
SELECT DISTINCT ON (eth_txes.nonce) eth_tx_attempts.*
FROM eth_tx_attempts
JOIN eth_txes ON eth_txes.id = eth_tx_attempts.eth_tx_id AND eth_txes.state IN ('unconfirmed', 'confirmed_missing_receipt')
WHERE eth_tx_attempts.state <> 'in_progress' AND eth_txes.broadcast_at <= $1 AND evm_chain_id = $2 AND from_address = $3
Expand Down

0 comments on commit de3c326

Please sign in to comment.