Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy to testnet #1523

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/api/v1/block_transactions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def show
block = Block.find_by!(block_hash: params[:id])
ckb_transactions = block.ckb_transactions.
select(:id, :tx_hash, :block_id, :block_number, :block_timestamp, :is_cellbase, :updated_at).
order(:id)
order(is_cellbase: :desc, id: :asc)

if params[:tx_hash].present?
ckb_transactions = ckb_transactions.where(tx_hash: params[:tx_hash])
Expand Down
13 changes: 13 additions & 0 deletions test/controllers/api/v1/block_transactions_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,19 @@ class BlockTransactionsControllerTest < ActionDispatch::IntegrationTest
assert_equal response_transaction, response.body
assert_equal 1, json.dig("meta", "total")
end

test "first tx should be cellbase" do
page = 1
page_size = 10
block = create(:block, :with_block_hash)
_ckb_transaction = create(:ckb_transaction, :with_multiple_inputs_and_outputs, block: block)
_cellbase_ckb_transaction = create(:ckb_transaction, block: block, is_cellbase: true)

valid_get api_v1_block_transaction_url(block.block_hash), params: {
page: page, page_size: page_size }

assert_equal true, json.dig("data").first["attributes"]["is_cellbase"]
end
end
end
end
Loading