Skip to content

Commit

Permalink
Update txn builder logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Warehime committed Jan 3, 2023
1 parent 65241c6 commit 1f154fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions idb/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ func buildTransactionQuery(tf idb.TransactionFilter) (query string, whereArgs []
}

// If returnInnerTxnOnly flag is false, then return the root transaction
if !tf.ReturnInnerTxnOnly && !tf.ReturnRootTxnsOnly {
if !(tf.ReturnInnerTxnOnly || tf.ReturnRootTxnsOnly) {
query = "SELECT t.round, t.intra, t.txn, root.txn, t.extra, t.asset, h.realtime FROM txn t JOIN block_header h ON t.round = h.round"
} else {
query = "SELECT t.round, t.intra, t.txn, NULL, t.extra, t.asset, h.realtime FROM txn t JOIN block_header h ON t.round = h.round"
Expand All @@ -674,7 +674,7 @@ func buildTransactionQuery(tf idb.TransactionFilter) (query string, whereArgs []
}

// join in the root transaction if the returnInnerTxnOnly flag is false
if !tf.ReturnInnerTxnOnly || !tf.ReturnRootTxnsOnly {
if !(tf.ReturnInnerTxnOnly || tf.ReturnRootTxnsOnly) {
query += " LEFT OUTER JOIN txn root ON t.round = root.round AND (t.extra->>'root-intra')::int = root.intra"
}

Expand Down

0 comments on commit 1f154fc

Please sign in to comment.