Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: destroy pending tx when exist samed commited tx #2018

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions app/workers/clean_up_worker.rb

This file was deleted.

4 changes: 4 additions & 0 deletions app/workers/pool_transaction_check_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
response_string = CkbSync::Api.instance.directly_single_call_rpc method: "get_transaction",
params: [tx.tx_hash]
reason = response_string["result"]["tx_status"]
if reason["status"] == "committed" && CkbTransaction.where(tx_hash: tx.tx_hash, tx_status: :committed).exists?
tx.destroy

Check warning on line 14 in app/workers/pool_transaction_check_worker.rb

View check run for this annotation

Codecov / codecov/patch

app/workers/pool_transaction_check_worker.rb#L14

Added line #L14 was not covered by tests
end

if reason["status"] == "rejected"
ApplicationRecord.transaction do
tx.update! tx_status: "rejected"
Expand Down
Loading