lib/zold/commands/fetch.rb in zold-0.31.5 vs lib/zold/commands/fetch.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
@@ -168,11 +168,11 @@
raise FetchError, "The wallet #{id} is in '#{wallet.network}', while we are in '#{opts['network']}'"
end
if wallet.balance.negative? && !wallet.root?
raise FetchError, "The balance of #{id} is #{wallet.balance} and it's not a root wallet"
end
- copy = cps.add(IO.read(f), score.host, score.port, score.value, master: r.master?)
+ copy = cps.add(File.read(f), score.host, score.port, score.value, master: r.master?)
@log.debug("#{r} returned #{wallet.mnemo} #{Age.new(json['mtime'])}/#{json['copies']}c \
as copy ##{copy}/#{cps.all.count} in #{Age.new(start, limit: 4)}: \
#{Rainbow(score.value).green} (#{json['version']})")
end
end
@@ -202,10 +202,10 @@
def existing_copy_added(id, cps, score, r, json)
cps.all.each do |c|
next unless json['digest'] == OpenSSL::Digest::SHA256.file(c[:path]).hexdigest &&
json['size'] == File.size(c[:path])
- copy = cps.add(IO.read(c[:path]), score.host, score.port, score.value, master: r.master?)
+ copy = cps.add(File.read(c[:path]), score.host, score.port, score.value, master: r.master?)
@log.debug("No need to fetch #{id} from #{r}, it's the same content as copy ##{copy}")
return true
end
false
end