diff --git a/app/models/ckb_sync/new_node_data_processor.rb b/app/models/ckb_sync/new_node_data_processor.rb index 2b1418899..c97db0211 100644 --- a/app/models/ckb_sync/new_node_data_processor.rb +++ b/app/models/ckb_sync/new_node_data_processor.rb @@ -1267,7 +1267,7 @@ def build_ckb_transactions!(node_block, local_block, inputs, outputs, outputs_da # locate correct record according to tx_hash binary_hashes = CkbUtils.hexes_to_bins_sql(hashes) pending_txs = CkbTransaction.where("tx_hash IN (#{binary_hashes})").where(tx_status: :pending).pluck( - :tx_hash, :created_at + :tx_hash, :confirmation_time ) CkbTransaction.where("tx_hash IN (#{binary_hashes})").update_all tx_status: "committed" @@ -1283,7 +1283,7 @@ def build_ckb_transactions!(node_block, local_block, inputs, outputs, outputs_da end.map do |tx| { id: tx["id"], tx_status: :committed, - confirmation_time: (tx["block_timestamp"].to_i / 1000) - hash_to_pool_times[tx["tx_hash"].tr("\\", "0")].to_i + confirmation_time: (tx["block_timestamp"].to_i - hash_to_pool_times[tx["tx_hash"].tr("\\", "0")].to_i) / 1000 } end CkbTransaction.upsert_all(confirmation_time_attrs, update_only: [:confirmation_time],