lib/zold/commands/create.rb in zold-0.31.5 vs lib/zold/commands/create.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
@@ -68,10 +68,14 @@
def create_id(opts)
loop do
id = Id.new
return id if opts['skip-test']
- found = false
+ found = @wallets.exists?(id)
+ if found
+ @log.debug("Wallet ID #{id} already exists locally, will try another one...")
+ next
+ end
@remotes.iterate(@log) do |r|
head = r.http("/wallet/#{id}/digest").get
found = true if head.status == 200
end
return id unless found