File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,8 @@ def increase_records_count(ckb_transactions)
5757 block_counter = TableRecordCount . find_by ( table_name : "blocks" )
5858 block_counter . increment! ( :count )
5959 ckb_transaction_counter = TableRecordCount . find_by ( table_name : "ckb_transactions" )
60- ckb_transaction_counter . increment! ( :count , ckb_transactions . count )
60+ normal_transactions = ckb_transactions . reject { |tx | tx . is_cellbase }
61+ ckb_transaction_counter . increment! ( :count , normal_transactions . count ) if normal_transactions . present?
6162 end
6263
6364 def update_udt_info ( udt_infos )
@@ -225,7 +226,8 @@ def decrease_records_count(local_tip_block)
225226 block_counter = TableRecordCount . find_by ( table_name : "blocks" )
226227 block_counter . decrement! ( :count )
227228 ckb_transaction_counter = TableRecordCount . find_by ( table_name : "ckb_transactions" )
228- ckb_transaction_counter . decrement! ( :count , local_tip_block . ckb_transactions . count )
229+ normal_transactions = local_tip_block . ckb_transactions . normal
230+ ckb_transaction_counter . decrement! ( :count , normal_transactions . count ) if normal_transactions . present?
229231 end
230232
231233 def recalculate_dao_contract_transactions_count ( local_tip_block )
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ class NodeDataProcessorTest < ActiveSupport::TestCase
4141 VCR . use_cassette ( "blocks/#{ DEFAULT_NODE_BLOCK_NUMBER } " ) do
4242 node_block = CkbSync ::Api . instance . get_block_by_number ( DEFAULT_NODE_BLOCK_NUMBER )
4343 create ( :block , :with_block_hash , number : node_block . header . number - 1 )
44- assert_difference -> { ckb_transaction_counter . reload . count } , node_block . transactions . count do
44+ assert_difference -> { ckb_transaction_counter . reload . count } , node_block . transactions [ 1 ..- 1 ] . count do
4545 node_data_processor . process_block ( node_block )
4646 end
4747 end
@@ -1368,7 +1368,7 @@ class NodeDataProcessorTest < ActiveSupport::TestCase
13681368 local_block . update ( block_hash : "0x419c632366c8eb9635acbb39ea085f7552ae62e1fdd480893375334a0f37d1bx" )
13691369
13701370 VCR . use_cassette ( "blocks/13" ) do
1371- assert_difference -> { ckb_transactions_counter . reload . count } , -local_block . ckb_transactions . count do
1371+ assert_difference -> { ckb_transactions_counter . reload . count } , -local_block . ckb_transactions . normal . count do
13721372 node_data_processor . call
13731373 end
13741374 end
You can’t perform that action at this time.
0 commit comments