From d08ed6810a47564d429ff8fd5c28d215e64c3476 Mon Sep 17 00:00:00 2001 From: Rabbit Date: Thu, 28 Dec 2023 11:08:53 +0800 Subject: [PATCH] fix: fixed contract synchronization (#1544) --- app/models/ckb_sync/new_node_data_processor.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/ckb_sync/new_node_data_processor.rb b/app/models/ckb_sync/new_node_data_processor.rb index 57cfcc062..da6360772 100644 --- a/app/models/ckb_sync/new_node_data_processor.rb +++ b/app/models/ckb_sync/new_node_data_processor.rb @@ -782,7 +782,7 @@ def build_cells_and_locks!( if contract temp_hash = temp_hash.merge is_contract: true, contract_id: contract.id else - contract = Contract.create code_hash: lock_script.script_hash + contract = Contract.create code_hash: lock_script.code_hash temp_hash = temp_hash.merge contract_id: contract.id end script = Script.find_or_create_by temp_hash @@ -796,7 +796,7 @@ def build_cells_and_locks!( type_script_ids.each do |type_script_id| type_script = TypeScript.find(type_script_id) temp_hash = { script_hash: type_script&.script_hash, is_contract: false } - contract = Contract.find_by code_hash: type_script.code_hash + contract = Contract.find_by code_hash: type_script.script_hash if contract temp_hash = temp_hash.merge is_contract: true, contract_id: contract.id