Skip to content

Commit

Permalink
Merge pull request #802 from oasisprotocol/andrew7234/consensus-tx-re…
Browse files Browse the repository at this point in the history
…l-account

api: filter rel accounts bugfix
  • Loading branch information
Andrew7234 authored Nov 22, 2024
2 parents 70f22d8 + b74cba0 commit 31d5c71
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions .changelog/802.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
api: update consensus/tx rel filter
4 changes: 2 additions & 2 deletions storage/client/queries/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ const (
JOIN chain.blocks ON chain.transactions.block = chain.blocks.height
LEFT JOIN chain.accounts_related_transactions ON chain.transactions.block = chain.accounts_related_transactions.tx_block
AND chain.transactions.tx_index = chain.accounts_related_transactions.tx_index
-- When related_address ($4) is NULL and hence we do no filtering on it, avoid the join altogether.
-- When related_address ($5) is NULL and hence we do no filtering on it, avoid the join altogether.
-- Otherwise, every tx will be returned as many times as there are related addresses for it.
AND $4::text IS NOT NULL
AND $5::text IS NOT NULL
WHERE ($1::text IS NULL OR chain.transactions.tx_hash = $1::text) AND
($2::bigint IS NULL OR chain.transactions.block = $2::bigint) AND
($3::text IS NULL OR chain.transactions.method = $3::text) AND
Expand Down

0 comments on commit 31d5c71

Please sign in to comment.