Skip to content

Commit 6f5319b

Browse files
authored
Merge pull request #2393 from nervosnetwork/develop
Deploy to testnet
2 parents 5c3532b + 992b4f3 commit 6f5319b

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

app/interactions/addresses/live_cells.rb

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,16 @@ def execute
1414
raise AddressNotFoundError if address.is_a?(NullAddress)
1515

1616
order_by, asc_or_desc = live_cells_ordering
17-
cell_outputs = CellOutput.includes(:bitcoin_vout).where(
18-
cell_outputs: { status: "live", address_id: address.map(&:id) },
19-
)
20-
cell_outputs = cell_outputs.where(bitcoin_vouts: { status: bound_status }) if bound_status
21-
cell_output_ids = cell_outputs.pluck("cell_outputs.id")
22-
records = CellOutput.where(id: cell_output_ids).order(order_by => asc_or_desc).
23-
page(page).per(page_size).fast_page
24-
options = FastJsonapi::PaginationMetaGenerator.new(
25-
request:, records:, page:, page_size:,
26-
).call
17+
if bound_status
18+
bitcoin_vouts = BitcoinVout.where(address_id: address.map(&:id), status: bound_status)
19+
records = CellOutput.live.where(id: bitcoin_vouts.map(&:cell_output_id)).order(order_by => asc_or_desc).
20+
page(page).per(page_size).fast_page
21+
else
22+
records = CellOutput.live.where(address_id: address.map(&:id)).order(order_by => asc_or_desc).
23+
page(page).per(page_size).fast_page
24+
end
2725

26+
options = FastJsonapi::PaginationMetaGenerator.new(request:, records:, page:, page_size:).call
2827
CellOutputSerializer.new(records, options).serialized_json
2928
end
3029

app/models/bitcoin_vout.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class BitcoinVout < ApplicationRecord
1313
def commitment
1414
return unless op_return?
1515

16-
script_pubkey = Bitcoin::Script.parse_from_payload(data.htb)
17-
script_pubkey.op_return_data.bth
16+
script_pub_key = Bitcoin::Script.parse_from_payload(data.htb)
17+
script_pub_key.op_return_data.bth
1818
end
1919
end
2020

0 commit comments

Comments
 (0)