Skip to content

Commit

Permalink
chore: optimize rgb_cells with status filter (#2045)
Browse files Browse the repository at this point in the history
  • Loading branch information
rabbitz authored Jul 9, 2024
1 parent 1c68749 commit 5039881
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/controllers/api/v2/bitcoin_addresses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def rgb_cells

cells = bitcoin_vouts.each_with_object({}) do |vout, hash|
tx = transactions[vout.bitcoin_transaction_id]
vouts = BitcoinVout.where(bitcoin_transaction_id: vout.bitcoin_transaction_id, index: vout.index).includes(:cell_output)
vouts = BitcoinVout.where(bitcoin_transaction_id: vout.bitcoin_transaction_id, index: vout.index).includes(:cell_output).where(
cell_outputs: { status: "live" },
)
hash[[tx.tx_hash, vout.index]] = vouts.map { |v| CellOutputSerializer.new(v.cell_output).serializable_hash }
end

Expand Down

0 comments on commit 5039881

Please sign in to comment.