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 +4 -4
- data/lib/zold/commands/remote.rb +7 -2
- data/lib/zold/http.rb +4 -4
- data/lib/zold/node/front.rb +2 -2
- data/lib/zold/patch.rb +1 -1
- data/lib/zold/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfad31c18d9d2a2cd394ad6048f510f0fd641829
|
4
|
+
data.tar.gz: 015adb1359b0b211176952d87bd273083a4e75e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5f085be6e9bb8fcdda41456aa2b45b23ea0202ef31c418190b34cec2e4a09f62e7c3f84d562e3933f827e0dd4909a7185bef76bf050566c42b88b62ed24767f
|
7
|
+
data.tar.gz: 122dba33d6bbc9de48af9e588873d7d5f7b00b7be6dcd9bedff4281bd3fcde478b0df38138a5785fb0e56a24783511d65762c1cbbd2f2074a59197945f249c3b
|
data/lib/zold/commands/remote.rb
CHANGED
@@ -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 =
|
62
|
-
http.open_timeout =
|
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.
|
73
|
-
http.
|
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(
|
data/lib/zold/node/front.rb
CHANGED
@@ -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,
|
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