zold 0.24.5 → 0.24.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e9d260c67c93b22986b2c4c7f34b905b68864cb98e6fa2b41fed7322fa8c08d
4
- data.tar.gz: 1c181196b0b7aa26f316a97ea782cd1c2a1dc8567c915f170277b5ceeabad81e
3
+ metadata.gz: 93b351cdb6572b8f2d7f00b22c93e3a2b973999e8fb2256792fe96a617f4ee2c
4
+ data.tar.gz: bbdbca8e6ed72a18e837678b2f317f625eee29ee74e6d6af0835bd45b4df1702
5
5
  SHA512:
6
- metadata.gz: e4341afb37bf3dbc709742f0371dc734cdc18e0e98ac621e9514f146474450e4ba23c37444b88e0c8b616c9b9f94c078ad350e3cf01a70131c43491f287c3b0d
7
- data.tar.gz: 6f3b4684dbd283761ea0053fa5d1b73eb58e2941af7386a9bdfd63de5ccd283d2b781f8e6e98df27d002f2c963852794c167772bababe918d1763cead117f84a
6
+ metadata.gz: bbed785fe1e0ca38331edf9fc5a81e541c90420a46102d65bd50246a190507fa73ebd49ddff1400c4f07118f888af2652bd952822c6ff2fe66bf07d38e303b45
7
+ data.tar.gz: 341bf97fe2174e1d605eb0d0c32ec7daa7473a8e51204208308aa7dabdfe6e8d50fc24b0f313ba388d54c5cc08fa8c9fb8316f72c8b0349bfd67817c3d17deb8
@@ -540,14 +540,14 @@ time to stop; use --skip-oom to never quit")
540
540
 
541
541
  def add_new_remote(score)
542
542
  all = settings.remotes.all
543
- return if all.count > Remotes::MAX_NODES && all.none? { |r| r[:error] > Remotes::TOLERANCE }
543
+ return if all.count > Remotes::MAX_NODES && all.none? { |r| r[:errors] > Remotes::TOLERANCE }
544
544
  begin
545
545
  require_relative '../commands/remote'
546
546
  Remote.new(remotes: settings.remotes, log: settings.log).run(
547
547
  [
548
548
  'remote', 'add', score.host, score.port.to_s,
549
549
  "--network=#{settings.opts['network']}", '--ignore-if-exists'
550
- ]
550
+ ] + (settings.opts['ignore-score-weakness'] ? ['--skip-ping'] : [])
551
551
  )
552
552
  rescue StandardError => e
553
553
  error(400, e.message)
data/lib/zold/txn.rb CHANGED
@@ -180,6 +180,9 @@ module Zold
180
180
  txn
181
181
  end
182
182
 
183
+ # When time can't be parsed.
184
+ class CantParseTime < StandardError; end
185
+
183
186
  ISO8601 = Regexp.new(
184
187
  '^' + [
185
188
  '(?<year>\d{4})',
@@ -194,7 +197,7 @@ module Zold
194
197
 
195
198
  def self.parse_time(iso)
196
199
  parts = ISO8601.match(iso)
197
- raise "Invalid ISO 8601 date \"#{iso}\"" if parts.nil?
200
+ raise CantParseTime, "Invalid ISO 8601 date \"#{iso}\"" if parts.nil?
198
201
  Time.gm(
199
202
  parts[:year].to_i, parts[:month].to_i, parts[:day].to_i,
200
203
  parts[:hours].to_i, parts[:minutes].to_i, parts[:seconds].to_i
data/lib/zold/version.rb CHANGED
@@ -25,7 +25,7 @@
25
25
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Zold
28
- VERSION = '0.24.5'
28
+ VERSION = '0.24.6'
29
29
  PROTOCOL = 2
30
30
  REPO = 'zold-io/zold'
31
31
  end
@@ -115,18 +115,23 @@ class FrontTest < Zold::Test
115
115
  end
116
116
 
117
117
  def test_updates_list_of_remotes
118
- FakeNode.new(log: test_log).run(['--ignore-score-weakness', '--no-cache']) do |port|
119
- score = Zold::Score.new(
120
- host: 'localhost', port: port, invoice: 'NOPREFIX@ffffffffffffffff', strength: 1
121
- ).next.next.next.next
122
- response = Zold::Http.new(uri: "http://localhost:#{port}/remotes", score: score).get
123
- assert_equal(200, response.status, response.body)
124
- assert_equal(1, Zold::JsonPage.new(response.body).to_hash['all'].count, response.body)
125
- assert_match(
126
- /(\d{4})-(\d{2})-(\d{2})T(\d{2})\:(\d{2})\:(\d{2})Z/,
127
- Zold::JsonPage.new(response.body).to_hash['mtime'].to_s,
128
- response.body
129
- )
118
+ FakeNode.new(log: test_log).run(['--ignore-score-weakness', '--no-metronome', '--no-cache']) do |port|
119
+ (Zold::Remotes::MAX_NODES + 5).times do |i|
120
+ score = Zold::Score.new(
121
+ host: 'localhost', port: i + 1, invoice: 'NOPREFIX@ffffffffffffffff', strength: 1
122
+ ).next.next.next.next
123
+ response = Zold::Http.new(uri: "http://localhost:#{port}/remotes", score: score).get
124
+ assert_equal(200, response.status, response.body)
125
+ assert_equal(
126
+ [i + 1, Zold::Remotes::MAX_NODES + 1].min,
127
+ Zold::JsonPage.new(response.body).to_hash['all'].count, response.body
128
+ )
129
+ assert_match(
130
+ /(\d{4})-(\d{2})-(\d{2})T(\d{2})\:(\d{2})\:(\d{2})Z/,
131
+ Zold::JsonPage.new(response.body).to_hash['mtime'].to_s,
132
+ response.body
133
+ )
134
+ end
130
135
  end
131
136
  end
132
137
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.5
4
+ version: 0.24.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
@@ -764,7 +764,7 @@ licenses:
764
764
  - MIT
765
765
  metadata: {}
766
766
  post_install_message: |-
767
- Thanks for installing Zold 0.24.5!
767
+ Thanks for installing Zold 0.24.6!
768
768
  Study our White Paper: https://papers.zold.io/wp.pdf
769
769
  Read our blog posts: https://blog.zold.io
770
770
  Try ZLD online wallet at: https://wts.zold.io