lib/zold/id.rb in zold-0.31.5 vs lib/zold/id.rb in zold-0.31.6
- old
+ new
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-# Copyright (c) 2018-2023 Zerocracy, Inc.
+# Copyright (c) 2018-2023 Zerocracy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the 'Software'), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@@ -32,16 +32,14 @@
# Pattern to match the ID
PTN = Regexp.new('^[0-9a-fA-F]{16}$')
private_constant :PTN
# Returns a list of banned IDs, as strings
- BANNED = begin
- CSV.read(File.join(__dir__, '../../resources/banned-wallets.csv')).map { |r| r[0] }
- end
+ BANNED = CSV.read(File.join(__dir__, '../../resources/banned-wallets.csv')).map { |r| r[0] }
def self.generate_id
loop do
- id = format('%016x', rand(2**32..2**64 - 1))
+ id = format('%016x', rand((2**32)..(2**64) - 1))
next if Id::BANNED.include?(id)
return id
end
end