Skip to content

Commit

Permalink
Merge branch 'issue-811' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
zmcNotafraid committed Jan 8, 2025
2 parents c27fa0b + d8c18aa commit 3e61276
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/models/block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,15 @@ def invalid!
uncle_blocks.delete_all
# delete_address_txs_cache
ckb_transaction_ids = ckb_transactions.pluck(:id)
tx_hashes = ckb_transactions.pluck(:tx_hash)
CellOutput.where(ckb_transaction_id: ckb_transaction_ids).delete_all
CellInput.where(ckb_transaction_id: ckb_transaction_ids).delete_all
AccountBook.where(ckb_transaction_id: ckb_transaction_ids).delete_all
CellDependency.where(ckb_transaction_id: ckb_transaction_ids).delete_all
cell_deps = CellDepsOutPoint.where(tx_hash: tx_hashes).select(:tx_hash, :cell_index)
cell_deps.each do |cell_dep|
Rails.cache.delete(["cell_output", cell_dep.tx_hash, cell_dep.cell_index])
end
HeaderDependency.where(ckb_transaction_id: ckb_transaction_ids).delete_all
TokenTransfer.where(transaction_id: ckb_transaction_ids).delete_all
Witness.where(ckb_transaction_id: ckb_transaction_ids).delete_all
Expand Down

0 comments on commit 3e61276

Please sign in to comment.