zold 0.13.40 → 0.13.41

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 578bc522cfcaed922a3440d80d38f95a69af7977
4
- data.tar.gz: 2e23c53f4812f19e33d0c4120c79c1361b2f9c9b
3
+ metadata.gz: cfad31c18d9d2a2cd394ad6048f510f0fd641829
4
+ data.tar.gz: 015adb1359b0b211176952d87bd273083a4e75e5
5
5
  SHA512:
6
- metadata.gz: 661e61e5f36b391b0c1815a3fa9032aacb8f52ab173b71e079bbc011e89b8abc7a38b9223b57ecbd30d517abd34ea6621c5faa7cbb4ae8ffbf9bf6ac7fc9b6d1
7
- data.tar.gz: 75d126c26de193a5b7e3646db1f9922602be31536acfeab6e46f24f869e4d398041bb340d0c541148c602478988f2d08dde9e433ccbc8ed02bb1902f3444df4b
6
+ metadata.gz: d5f085be6e9bb8fcdda41456aa2b45b23ea0202ef31c418190b34cec2e4a09f62e7c3f84d562e3933f827e0dd4909a7185bef76bf050566c42b88b62ed24767f
7
+ data.tar.gz: 122dba33d6bbc9de48af9e588873d7d5f7b00b7be6dcd9bedff4281bd3fcde478b0df38138a5785fb0e56a24783511d65762c1cbbd2f2074a59197945f249c3b
@@ -31,6 +31,7 @@ require_relative '../json_page'
31
31
  require_relative '../http'
32
32
  require_relative '../remotes'
33
33
  require_relative '../score'
34
+ require_relative '../wallet'
34
35
 
35
36
  # REMOTE command.
36
37
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
@@ -78,6 +79,10 @@ Available options:"
78
79
  o.bool '--skip-ping',
79
80
  'Don\'t ping back the node when adding it (not recommended)',
80
81
  default: false
82
+ o.string '--network',
83
+ "The name of the network we work in (default: #{Wallet::MAIN_NETWORK}",
84
+ required: true,
85
+ default: Wallet::MAIN_NETWORK
81
86
  o.bool '--reboot',
82
87
  'Exit if any node reports version higher than we have',
83
88
  default: false
@@ -130,8 +135,8 @@ Available options:"
130
135
 
131
136
  def add(host, port, opts)
132
137
  unless opts['skip-ping']
133
- res = Http.new("http://#{host}:#{port}/version").get
134
- raise "The node #{host}:#{port} is not responding" unless res.code == '200'
138
+ res = Http.new("http://#{host}:#{port}/version", network: opts['network']).get
139
+ raise "The node #{host}:#{port} is not responding (code is #{res.code})" unless res.code == '200'
135
140
  end
136
141
  if @remotes.exists?(host, port)
137
142
  raise "#{host}:#{port} already exists in the list" unless opts['force']
data/lib/zold/http.rb CHANGED
@@ -58,8 +58,8 @@ module Zold
58
58
 
59
59
  def get
60
60
  http = Net::HTTP.new(@uri.host, @uri.port)
61
- http.read_timeout = 5
62
- http.open_timeout = 5
61
+ http.read_timeout = 8
62
+ http.open_timeout = 4
63
63
  path = @uri.path
64
64
  path += '?' + @uri.query if @uri.query
65
65
  http.request_get(path, headers)
@@ -69,8 +69,8 @@ module Zold
69
69
 
70
70
  def put(body)
71
71
  http = Net::HTTP.new(@uri.host, @uri.port)
72
- http.open_timeout = 5
73
- http.read_timeout = 10
72
+ http.read_timeout = 16
73
+ http.open_timeout = 4
74
74
  path = @uri.path
75
75
  path += '?' + @uri.query if @uri.query
76
76
  http.request_put(
@@ -43,7 +43,7 @@ module Zold
43
43
  configure do
44
44
  set :bind, '0.0.0.0'
45
45
  set :suppress_messages, true
46
- set :dump_errors, true
46
+ set :dump_errors, false
47
47
  set :start, Time.now
48
48
  set :lock, false
49
49
  set :show_exceptions, false
@@ -81,7 +81,7 @@ module Zold
81
81
  if s.value > 3
82
82
  require_relative '../commands/remote'
83
83
  Remote.new(remotes: settings.remotes, log: settings.log).run(
84
- ['remote', 'add', s.host, s.port.to_s, '--force']
84
+ ['remote', 'add', s.host, s.port.to_s, '--force', "--network=#{settings.network}"]
85
85
  )
86
86
  else
87
87
  settings.log.debug("#{request.url}: the score is too weak: #{s}")
data/lib/zold/patch.rb CHANGED
@@ -75,7 +75,7 @@ module Zold
75
75
  next
76
76
  end
77
77
  if @txns.map(&:amount).map(&:to_i).inject(&:+).to_i < txn.amount.to_i * -1 && !wallet.root?
78
- @log.error("Transaction ##{txn.id} attempts to make the balance negative: #{txn.to_text}")
78
+ @log.error("Transaction ##{txn.id} attempts to make the balance of #{wallet.id} negative: #{txn.to_text}")
79
79
  next
80
80
  end
81
81
  unless Signature.new.valid?(@key, wallet.id, txn)
data/lib/zold/version.rb CHANGED
@@ -23,5 +23,5 @@
23
23
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module Zold
26
- VERSION = '0.13.40'.freeze
26
+ VERSION = '0.13.41'.freeze
27
27
  end
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.13.40
4
+ version: 0.13.41
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko