lib/zold/commands/fetch.rb in zold-0.18.9 vs lib/zold/commands/fetch.rb in zold-0.19.0

- old
+ new

@@ -65,11 +65,11 @@ default: false o.array '--ignore-node', 'Ignore this node and don\'t fetch from it', default: [] o.bool '--tolerate-edges', - 'Don\'t fail if only "edge" (not default ones) nodes accepted the wallet', + 'Don\'t fail if only "edge" (not "master" ones) nodes accepted the wallet', default: false o.bool '--quiet-if-absent', 'Don\'t fail if the wallet is absent in all remote nodes', default: false o.string '--network', @@ -92,25 +92,25 @@ def fetch(id, cps, opts) start = Time.now total = Concurrent::AtomicFixnum.new nodes = Concurrent::AtomicFixnum.new done = Concurrent::AtomicFixnum.new - defaults = Concurrent::AtomicFixnum.new + masters = Concurrent::AtomicFixnum.new @remotes.iterate(@log) do |r| nodes.increment total.increment(fetch_one(id, r, cps, opts)) - defaults.increment if r.default? + masters.increment if r.master? done.increment end raise "There are no remote nodes, run 'zold remote reset'" if nodes.value.zero? unless opts['quiet-if-absent'] raise "No nodes out of #{nodes.value} have the wallet #{id}" if done.value.zero? - if defaults.value.zero? && !opts['tolerate-edges'] + if masters.value.zero? && !opts['tolerate-edges'] raise "There are only edge nodes, run 'zold remote reset' or use --tolerate-edges" end end @log.info("#{done.value} copies of #{id} fetched in #{Age.new(start)} with the total score of \ -#{total.value} from #{nodes.value} nodes (#{defaults.value} defaults)") +#{total.value} from #{nodes.value} nodes (#{masters.value} master nodes)") list = cps.all.map do |c| " ##{c[:name]}: #{c[:score]} #{Wallet.new(c[:path]).mnemo} \ #{Size.new(File.size(c[:path]))}/#{Age.new(File.mtime(c[:path]))}" end @log.debug("#{cps.all.count} local copies of #{id}:\n#{list.join("\n")}")