Skip to content

Commit

Permalink
chore: log transaction deletion chain (#1491)
Browse files Browse the repository at this point in the history
  • Loading branch information
rabbitz authored Nov 6, 2023
1 parent 896fa7d commit 67bfec1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/models/ckb_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class CkbTransaction < ApplicationRecord

after_commit :flush_cache
before_destroy :recover_dead_cell
before_destroy :log_deletion_chain

def self.cached_find(query_key)
Rails.cache.realize([name, query_key], race_condition_ttl: 3.seconds) do
Expand Down Expand Up @@ -434,6 +435,12 @@ def cellbase_display_inputs
def recover_dead_cell
inputs.update_all(status: "live", consumed_by_id: nil, consumed_block_timestamp: nil)
end

def log_deletion_chain
unless tx_pending?
Rails.logger.info "Deleting #{self.class.name} with ID #{id} using #{caller}: #{as_json}"
end
end
end

# == Schema Information
Expand Down

0 comments on commit 67bfec1

Please sign in to comment.