Skip to content

Commit

Permalink
fix: locate cell_output in committed transaction (#1502)
Browse files Browse the repository at this point in the history
  • Loading branch information
rabbitz authored Nov 16, 2023
1 parent 00b07cd commit 7c06249
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
3 changes: 1 addition & 2 deletions app/models/cell_output.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ def self.find_by_pointer(tx_hash, index)
Rails.cache.fetch(["cell_output", tx_hash, index], skip_nil: true,
race_condition_ttl: 10.seconds,
expires_in: 1.day) do
tx_id = CkbTransaction.find_by_tx_hash(tx_hash)&.id

tx_id = CkbTransaction.tx_committed.find_by_tx_hash(tx_hash)&.id
Rails.logger.info("find_by_pointer: tx_hash: #{tx_hash}, index: #{index}, tx_id: #{tx_id}")
find_by(ckb_transaction_id: tx_id, cell_index: index.is_a?(String) ? index.hex : index) if tx_id
end
Expand Down
2 changes: 0 additions & 2 deletions app/models/deployed_cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def self.create_initial_data(ckb_transaction_id = 0)

def self.create_initial_data_for_ckb_transaction(ckb_transaction, cell_deps)
return if cell_deps.blank?
Rails.logger.info("create cell deps cell_deps: #{cell_deps}")

deployed_cells = []
cell_dependencies_attrs = []
Expand All @@ -67,7 +66,6 @@ def self.create_initial_data_for_ckb_transaction(ckb_transaction, cell_deps)
parse_code_dep =
->(cell_dep) do
# this cell output is the contract cell, i.e. one of deployed cells of the contract
Rails.logger.info("parse_code_dep cell_dep: #{cell_dep}")
cell_output = CellOutput.find_by_pointer cell_dep["out_point"]["tx_hash"], cell_dep["out_point"]["index"]

attr = {
Expand Down

0 comments on commit 7c06249

Please sign in to comment.