zold 0.13.41 → 0.13.42
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 +4 -4
- data/lib/zold/commands/push.rb +2 -1
- data/lib/zold/node/front.rb +16 -1
- data/lib/zold/patch.rb +4 -2
- 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: af5c3740f905dabd3a8e7454e7b0bf65d9c3472b
|
4
|
+
data.tar.gz: 91b089acdcca61e29768a8b2a31cc8f046d71ef4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90ce9c75f3b34aa7d6eac595eea885977875721c5bc258dbdd8b8f851182ed80e7968ea4722e068670f93e97f162d8507e6dc53f758456c54cf74a7aab56bfa6
|
7
|
+
data.tar.gz: de73f91cf870c7bc3b8236e297e7e93a5f9f2e9ec37c4db7fa9b1ad56aafbc8c3e32a92a944d3f57b461916992671fb5650581ce4eed64ad1d2c34eeac939605
|
data/lib/zold/commands/push.rb
CHANGED
@@ -88,7 +88,8 @@ Available options:"
|
|
88
88
|
content = AtomicFile.new(wallet.path).read
|
89
89
|
response = r.http("/wallet/#{wallet.id}#{opts['sync'] ? '?sync=true' : ''}").put(content)
|
90
90
|
if response.code == '304'
|
91
|
-
@log.info("#{r}: same version
|
91
|
+
@log.info("#{r}: same version #{content.length}b/#{wallet.txns.count}t \
|
92
|
+
of #{wallet.id} there, in #{(Time.now - start).round(2)}s")
|
92
93
|
return 0
|
93
94
|
end
|
94
95
|
r.assert_code(200, response)
|
data/lib/zold/node/front.rb
CHANGED
@@ -167,7 +167,22 @@ module Zold
|
|
167
167
|
wallet = settings.wallets.find(id)
|
168
168
|
error 404 unless wallet.exists?
|
169
169
|
content_type 'text/plain'
|
170
|
-
wallet.key.to_s
|
170
|
+
wallet.key.to_s
|
171
|
+
end
|
172
|
+
|
173
|
+
get %r{/wallet/(?<id>[A-Fa-f0-9]{16})\.txt} do
|
174
|
+
id = Id.new(params[:id])
|
175
|
+
wallet = settings.wallets.find(id)
|
176
|
+
error 404 unless wallet.exists?
|
177
|
+
content_type 'text/plain'
|
178
|
+
[
|
179
|
+
wallet.network,
|
180
|
+
wallet.version,
|
181
|
+
wallet.id.to_s,
|
182
|
+
wallet.key.to_s,
|
183
|
+
'',
|
184
|
+
wallet.txns.map(&:to_text).join("\n")
|
185
|
+
].join("\n")
|
171
186
|
end
|
172
187
|
|
173
188
|
put %r{/wallet/(?<id>[A-Fa-f0-9]{16})/?} do
|
data/lib/zold/patch.rb
CHANGED
@@ -74,8 +74,10 @@ module Zold
|
|
74
74
|
@log.error("An attempt to overwrite #{dup.to_text} with this: #{txn.to_text}")
|
75
75
|
next
|
76
76
|
end
|
77
|
-
|
78
|
-
|
77
|
+
balance = @txns.map(&:amount).map(&:to_i).inject(&:+).to_i
|
78
|
+
if balance < txn.amount.to_i * -1 && !wallet.root?
|
79
|
+
@log.error("Transaction ##{txn.id} attempts to make the balance of \
|
80
|
+
#{wallet.id}/#{Amount.new(coins: balance).to_zld}/#{@txns.size} negative: #{txn.to_text}")
|
79
81
|
next
|
80
82
|
end
|
81
83
|
unless Signature.new.valid?(@key, wallet.id, txn)
|
data/lib/zold/version.rb
CHANGED