zold 0.18.4 → 0.18.5
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/routines/gc.rb +1 -1
- data/lib/zold/node/front.rb +1 -5
- data/lib/zold/node/soft_error.rb +1 -1
- data/lib/zold/txn.rb +1 -1
- data/lib/zold/version.rb +1 -1
- data/test/node/test_safe_entrance.rb +2 -1
- data/test/test_age.rb +1 -0
- data/test/test_amount.rb +1 -0
- data/test/test_size.rb +1 -0
- data/test/test_txn.rb +16 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 107b5e77f3c4f52c9331511957365add6116ffaf33fd8c1a0ffe61d86658deca
|
4
|
+
data.tar.gz: 38a6934d82c1fe5fafa93109bf587c5d108e703eaa8b832330845fd110be6b30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30fc094ba1a6e69eb1e2dc8ca2b735197f29e8834c79baac950e3b1e873876beeaee169761115d9a8d50b0bbbfd8d453b9c5b6705ce0231aa5f4ed7dea5479f3
|
7
|
+
data.tar.gz: 92bdb792f17ba0d73b8375139dc510ac1897a637d95db712275423cbcadf4028a03ce3dc80290b37c32b55f95095a5d964b45a47043b7004c30925ed010d5621
|
@@ -47,7 +47,7 @@ module Zold
|
|
47
47
|
removed = 0
|
48
48
|
@wallets.all.each do |id|
|
49
49
|
seen += 1
|
50
|
-
next unless @wallets.acq(id) { |w| w.txns.empty? && w.mtime < Time.now - @opts['gc-age'] }
|
50
|
+
next unless @wallets.acq(id) { |w| w.exists? && w.txns.empty? && w.mtime < Time.now - @opts['gc-age'] }
|
51
51
|
cmd.run(args + [id.to_s])
|
52
52
|
removed += 1
|
53
53
|
end
|
data/lib/zold/node/front.rb
CHANGED
@@ -308,7 +308,7 @@ from #{request.ip} in #{Age.new(@start, limit: 1)}")
|
|
308
308
|
end
|
309
309
|
|
310
310
|
get %r{/wallet/(?<id>[A-Fa-f0-9]{16})/txns.json} do
|
311
|
-
fetch { |w| pretty(w.txns.map(&:to_json)) }
|
311
|
+
fetch('application/json') { |w| pretty(w.txns.map(&:to_json)) }
|
312
312
|
end
|
313
313
|
|
314
314
|
get %r{/wallet/(?<id>[A-Fa-f0-9]{16})\.txt} do
|
@@ -455,11 +455,7 @@ time to stop; use --skip-oom to never quit")
|
|
455
455
|
yield header
|
456
456
|
end
|
457
457
|
|
458
|
-
# @todo #513:30min This method is temporarily disabled since it
|
459
|
-
# takes a lot of time (when the amount of wallets is big, like 40K). However,
|
460
|
-
# we must find a way to count them somehow faster.
|
461
458
|
def total_wallets
|
462
|
-
return 256 if settings.opts['network'] == Wallet::MAINET
|
463
459
|
settings.zache.get(:wallets, lifetime: settings.opts['no-cache'] ? 0 : 60) do
|
464
460
|
settings.wallets.count
|
465
461
|
end
|
data/lib/zold/node/soft_error.rb
CHANGED
data/lib/zold/txn.rb
CHANGED
data/lib/zold/version.rb
CHANGED
@@ -27,6 +27,7 @@ require_relative '../../lib/zold/wallet'
|
|
27
27
|
require_relative '../../lib/zold/id'
|
28
28
|
require_relative '../../lib/zold/key'
|
29
29
|
require_relative '../../lib/zold/node/safe_entrance'
|
30
|
+
require_relative '../../lib/zold/node/soft_error'
|
30
31
|
require_relative 'fake_entrance'
|
31
32
|
|
32
33
|
# SafeEntrance test.
|
@@ -40,7 +41,7 @@ class TestSafeEntrance < Zold::Test
|
|
40
41
|
amount = Zold::Amount.new(zld: 39.99)
|
41
42
|
key = Zold::Key.new(file: 'fixtures/id_rsa')
|
42
43
|
wallet.sub(amount, "NOPREFIX@#{Zold::Id.new}", key)
|
43
|
-
assert_raises
|
44
|
+
assert_raises Zold::SoftError do
|
44
45
|
Zold::SafeEntrance.new(FakeEntrance.new).push(wallet.id, IO.read(wallet.path))
|
45
46
|
end
|
46
47
|
end
|
data/test/test_age.rb
CHANGED
data/test/test_amount.rb
CHANGED
data/test/test_size.rb
CHANGED
data/test/test_txn.rb
CHANGED
@@ -23,6 +23,7 @@
|
|
23
23
|
require 'minitest/autorun'
|
24
24
|
require 'tmpdir'
|
25
25
|
require 'time'
|
26
|
+
require_relative 'test__helper'
|
26
27
|
require_relative '../lib/zold/id'
|
27
28
|
require_relative '../lib/zold/txn'
|
28
29
|
require_relative '../lib/zold/amount'
|
@@ -46,6 +47,21 @@ class TestTxn < Zold::Test
|
|
46
47
|
assert_equal('NOPREFIX', txn.prefix)
|
47
48
|
end
|
48
49
|
|
50
|
+
def test_converts_to_json
|
51
|
+
time = Time.now
|
52
|
+
txn = Zold::Txn.new(
|
53
|
+
123, time, Zold::Amount.new(zld: -99.95),
|
54
|
+
'NOPREFIX', Zold::Id.new('0123012301230123'),
|
55
|
+
'Some details to see'
|
56
|
+
)
|
57
|
+
json = txn.to_json
|
58
|
+
assert_equal(123, json[:id])
|
59
|
+
assert_equal(-429_281_981_235, json[:amount])
|
60
|
+
assert_equal('NOPREFIX', json[:prefix])
|
61
|
+
assert_equal('0123012301230123', json[:bnf])
|
62
|
+
assert_equal('Some details to see', json[:details])
|
63
|
+
end
|
64
|
+
|
49
65
|
def test_accepts_text_as_details
|
50
66
|
details = 'How are you, dude?! I\'m @yegor256: *_hello_'
|
51
67
|
txn = Zold::Txn.parse(
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.18.
|
4
|
+
version: 0.18.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|
@@ -703,7 +703,7 @@ licenses:
|
|
703
703
|
- MIT
|
704
704
|
metadata: {}
|
705
705
|
post_install_message: |-
|
706
|
-
Thanks for installing Zold 0.18.
|
706
|
+
Thanks for installing Zold 0.18.5!
|
707
707
|
Study our White Paper: https://papers.zold.io/wp.pdf
|
708
708
|
Read our blog posts: https://blog.zold.io
|
709
709
|
Try online wallet at: https://wts.zold.io
|