zold 0.13.44 → 0.13.45
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/merge.rb +0 -4
- data/lib/zold/node/async_entrance.rb +2 -2
- data/lib/zold/node/entrance.rb +2 -1
- data/lib/zold/node/front.rb +5 -1
- data/lib/zold/remotes.rb +1 -1
- data/lib/zold/version.rb +1 -1
- data/test/commands/test_merge.rb +12 -0
- data/test/test_remotes.rb +3 -2
- 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: 622dc23ea0837dff3dd0dfefb7fb14cf2dadc7b7
|
4
|
+
data.tar.gz: a41c3ecde8b70c7d91ba87750122d7ec4183818f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f570ce49f29485a9651c48ede80cab98cd270d2a750f4ec02570ee0886dad62be9e0f4444d45f582b210c6ae2b87a6ec9a9dfc4486696bf09101c55d16700cf
|
7
|
+
data.tar.gz: d8b64b55bfe0f04daa6830b4246a3d50f7a6277c15de193148b8a52fccee0c461d17ca2754090116c654b835be12b70f3a120010807725382e2c6c42fb007419
|
data/lib/zold/commands/merge.rb
CHANGED
@@ -65,10 +65,6 @@ Available options:"
|
|
65
65
|
private
|
66
66
|
|
67
67
|
def merge(id, cps, opts)
|
68
|
-
if cps.all.empty?
|
69
|
-
@log.error("There are no remote copies of #{id}, try 'zold fetch' first")
|
70
|
-
return
|
71
|
-
end
|
72
68
|
cps = cps.all.sort_by { |c| c[:score] }.reverse
|
73
69
|
patch = Patch.new(@wallets, log: @log)
|
74
70
|
cps.each do |c|
|
@@ -39,8 +39,8 @@ module Zold
|
|
39
39
|
def start
|
40
40
|
@entrance.start do
|
41
41
|
@pool = Concurrent::FixedThreadPool.new(
|
42
|
-
Concurrent.processor_count,
|
43
|
-
max_queue: Concurrent.processor_count *
|
42
|
+
Concurrent.processor_count * 8,
|
43
|
+
max_queue: Concurrent.processor_count * 32,
|
44
44
|
fallback_policy: :abort
|
45
45
|
)
|
46
46
|
begin
|
data/lib/zold/node/entrance.rb
CHANGED
@@ -89,7 +89,8 @@ module Zold
|
|
89
89
|
end
|
90
90
|
@mutex.synchronize do
|
91
91
|
@history.shift if @history.length > 16
|
92
|
-
|
92
|
+
wallet = @wallets.find(id)
|
93
|
+
@history << "#{id}/#{sec}/#{modified.count}/#{wallet.balance.to_zld}/#{wallet.txns.count}t"
|
93
94
|
end
|
94
95
|
modified
|
95
96
|
end
|
data/lib/zold/node/front.rb
CHANGED
@@ -181,7 +181,11 @@ module Zold
|
|
181
181
|
wallet.id.to_s,
|
182
182
|
wallet.key.to_s,
|
183
183
|
'',
|
184
|
-
wallet.txns.map(&:to_text).join("\n")
|
184
|
+
wallet.txns.map(&:to_text).join("\n"),
|
185
|
+
'',
|
186
|
+
'--',
|
187
|
+
'Balance: ' + wallet.balance,
|
188
|
+
'Transactions: ' + wallet.txns.count
|
185
189
|
].join("\n")
|
186
190
|
end
|
187
191
|
|
data/lib/zold/remotes.rb
CHANGED
data/lib/zold/version.rb
CHANGED
data/test/commands/test_merge.rb
CHANGED
@@ -123,6 +123,18 @@ class TestMerge < Minitest::Test
|
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
|
+
def test_removes_negative_fakes
|
127
|
+
FakeHome.new.run do |home|
|
128
|
+
wallet = home.create_wallet
|
129
|
+
key = Zold::Key.new(file: 'fixtures/id_rsa')
|
130
|
+
wallet.sub(Zold::Amount.new(zld: 9.99), "NOPREFIX@#{Zold::Id.new}", key)
|
131
|
+
Zold::Merge.new(wallets: home.wallets, copies: home.copies.root, log: test_log).run(
|
132
|
+
['merge', wallet.id.to_s, '--no-baseline']
|
133
|
+
)
|
134
|
+
assert_equal(Zold::Amount::ZERO, wallet.balance)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
126
138
|
def test_merges_scenarios
|
127
139
|
base = 'fixtures/merge'
|
128
140
|
Dir.new(base).select { |f| File.directory?(File.join(base, f)) && !f.start_with?('.') }.each do |f|
|
data/test/test_remotes.rb
CHANGED
@@ -118,10 +118,11 @@ class TestRemotes < Minitest::Test
|
|
118
118
|
file = File.join(dir, 'remotes')
|
119
119
|
FileUtils.touch(file)
|
120
120
|
remotes = Zold::Remotes.new(file)
|
121
|
-
remotes.add('127.0.0.1',
|
122
|
-
remotes.rescore('127.0.0.1',
|
121
|
+
remotes.add('127.0.0.1', 1024)
|
122
|
+
remotes.rescore('127.0.0.1', 1024, 15)
|
123
123
|
remotes.all.each do |r|
|
124
124
|
assert_equal(15, r[:score])
|
125
|
+
assert_equal('http://127.0.0.1:1024/', r[:home].to_s)
|
125
126
|
end
|
126
127
|
end
|
127
128
|
end
|