From 928b86957b9a473a4361bbf03570ae4556296e33 Mon Sep 17 00:00:00 2001 From: Rabbit Date: Tue, 2 Jan 2024 17:26:07 +0800 Subject: [PATCH] fix: contract synchronization (#1550) --- 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 da6360772..57cfcc062 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.code_hash + contract = Contract.create code_hash: lock_script.script_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.script_hash + contract = Contract.find_by code_hash: type_script.code_hash if contract temp_hash = temp_hash.merge is_contract: true, contract_id: contract.id