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: unique udt attributes by type_hash #2238

Merged
Merged
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
5 changes: 2 additions & 3 deletions app/models/ckb_sync/new_node_data_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,8 @@ def build_udts!(local_block, outputs, outputs_data)
end
end
if udts_attributes.present?
returning_attrs = Udt.insert_all!(udts_attributes.map! do |attr|
attr.merge!(created_at: Time.current, updated_at: Time.current)
end, returning: %w[id udt_type type_hash])
unique_udt_attributes = udts_attributes.uniq { |ua| ua[:type_hash] }
returning_attrs = Udt.insert_all!(unique_udt_attributes, record_timestamps: true, returning: %w[id udt_type type_hash])
omiga_inscription_info_attrs = returning_attrs.rows.filter do |r|
r[1] == 4
end.map do |k|
Expand Down
Loading