Skip to content

Commit

Permalink
Merge pull request #1524 from nervosnetwork/testnet
Browse files Browse the repository at this point in the history
Deploy to mainnet
  • Loading branch information
zmcNotafraid authored Dec 4, 2023
2 parents fdd9cb1 + 7508160 commit ef6b728
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
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

0 comments on commit ef6b728

Please sign in to comment.