From d6780a9ef39a824be4062c752663f7f9b0056c3f Mon Sep 17 00:00:00 2001 From: Miles Zhang Date: Fri, 30 Aug 2024 10:50:11 +0800 Subject: [PATCH] feat: remove duplicate xudt check (#2167) Signed-off-by: Miles Zhang --- app/workers/xudt_tag_worker.rb | 6 ------ test/workers/xudt_tag_worker_test.rb | 10 ---------- 2 files changed, 16 deletions(-) diff --git a/app/workers/xudt_tag_worker.rb b/app/workers/xudt_tag_worker.rb index b47bf491e..f2e3a8cca 100644 --- a/app/workers/xudt_tag_worker.rb +++ b/app/workers/xudt_tag_worker.rb @@ -26,8 +26,6 @@ def mark_tags(udt) ["out-of-length-range"] elsif utility_lp_token?(udt.args) ["utility"] - elsif !first_xudt?(udt.symbol, udt.block_timestamp) - ["suspicious"] elsif single_use_lock?(udt.issuer_address) ["supply-limited"] elsif rgbpp_lock?(udt.issuer_address) @@ -49,10 +47,6 @@ def out_of_length?(symbol) symbol.length > 60 end - def first_xudt?(symbol, block_timestamp) - !Udt.published_xudt.where("LOWER(symbol) = ?", symbol.downcase).where("block_timestamp < ?", block_timestamp).exists? - end - def rgbpp_lock?(issuer_address) address_code_hash = CkbUtils.parse_address(issuer_address).script.code_hash issuer_address.present? && CkbSync::Api.instance.rgbpp_code_hash.include?(address_code_hash) diff --git a/test/workers/xudt_tag_worker_test.rb b/test/workers/xudt_tag_worker_test.rb index bd6577b94..7ed795dfb 100644 --- a/test/workers/xudt_tag_worker_test.rb +++ b/test/workers/xudt_tag_worker_test.rb @@ -62,14 +62,4 @@ class XudtTagWorkerTest < ActiveJob::TestCase end assert_equal ["utility", "rgb++"], XudtTag.last.tags end - - test "insert suspicious tag when not lp token but duplicate" do - udt = create(:udt, :xudt, symbol: "CKBBB", block_timestamp: 1.day.ago.to_i * 1000) - create(:xudt_tag, udt_id: udt.id, udt_type_hash: udt.type_hash, tags: ["rgb++", "layer-1-asset", "supply-limited"]) - create(:udt, :xudt, symbol: "ckbbb", block_timestamp: Time.now.to_i * 1000, issuer_address: @address.address_hash) - assert_changes -> { XudtTag.count }, from: 1, to: 2 do - XudtTagWorker.new.perform - end - assert_equal ["suspicious", "rgb++"], XudtTag.last.tags - end end