lib/zold/commands/fetch.rb in zold-0.16.24 vs lib/zold/commands/fetch.rb in zold-0.16.25
- old
+ new
@@ -105,11 +105,11 @@
end
uri = "/wallet/#{id}"
size = r.http(uri + '/size').get
r.assert_code(200, size)
res = r.http(uri).get(timeout: 2 + size.body.to_i * 0.01 / 1024)
- raise "Wallet #{id} not found" if res.code == '404'
+ raise "Wallet #{id} not found" if res.status == '404'
r.assert_code(200, res)
json = JsonPage.new(res.body, uri).to_hash
score = Score.parse_json(json['score'])
r.assert_valid_score(score)
r.assert_score_ownership(score)
@@ -128,10 +128,11 @@
if wallet.balance.negative? && !wallet.root?
raise "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)
@log.info("#{r} returned #{wallet.mnemo} #{Age.new(json['mtime'])}/#{json['copies']}c \
-as copy ##{copy} in #{Age.new(start, limit: 4)}: #{Rainbow(score.value).green} (#{json['version']})")
+as copy ##{copy}/#{cps.all.count} in #{Age.new(start, limit: 4)}: \
+#{Rainbow(score.value).green} (#{json['version']})")
end
score.value
end
def digest(json)