zold 0.22.6 → 0.22.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fixtures/merge/legacy-negatives-stay/0123456789abcdef.z +6 -0
- data/fixtures/merge/legacy-negatives-stay/assert.rb +25 -0
- data/fixtures/merge/legacy-negatives-stay/copies/0123456789abcdef/1.zc +6 -0
- data/fixtures/merge/legacy-negatives-stay/copies/0123456789abcdef/scores.zc +1 -0
- data/lib/zold/commands/merge.rb +10 -9
- data/lib/zold/commands/pay.rb +4 -1
- data/lib/zold/node/entrance.rb +1 -1
- data/lib/zold/patch.rb +18 -18
- data/lib/zold/version.rb +1 -1
- data/test/commands/test_merge.rb +6 -5
- data/test/test_patch.rb +19 -13
- data/upgrades/rename_foreign_wallets.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c98e24178b0b7da594111beaa66a1461d04aa876efafe8b66baa2862fbef5029
|
4
|
+
data.tar.gz: a9cf58c9298c540621ec5bf779e3385072142dc9b727a04ea2cca1142e37ef46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a53f3e0a978221f70fe989b8b2f4230630a34a816a3e9a580b54fb3a8e2b12c4a3cd48a46500b33e41d7ce833bfa52ad78c9aba4410ee56ee6c8a04e4918a4df
|
7
|
+
data.tar.gz: a511a6b96eb83db16b51c7f8db2b8613bc83d8789a0fbd0b1078c6204e6c4772a76966a4d5a42e4516b02aaafbd90ccb63747b1b7469c39348e70f8874cbc980
|
@@ -0,0 +1,6 @@
|
|
1
|
+
test
|
2
|
+
2
|
3
|
+
0123456789abcdef
|
4
|
+
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnppnkzrCreiKaHF09XKS6bO+2274+wSGo+F8KHvVrNbqear/e09r9PB/P6bFdLoMh4Xc7p/7+NSEZLeu2Eg/dBkQLEb8M/zgkT4gBDGyETW/zusYHIznX/lgf0f8qleIQIIB/3Y7QpDztkamWYTKWlnmlrcQvCVB0uRRPm4ZMcMJouKR9n7E2DpL9eolKyOwr/JY08iJOuK3HuW6tRdvE+0x7I+wDprM65OH/PoArlfO5qnIGbeXwsEGRXt0w6a/ubPpeadFjPXotE7cT1SA4YSD1tWTIVm1ZWppOE967XoDIum6tzt5KfzDNRfs9GbCfO0BL235HxbO8I9rTlVLTKcNAiEe0CWolY9HR5pMaosOgZ6PB54InJEZJs4L2b10c+IlVUX1RSnwfFYg0vy5oqrYyqt7gnipl/06YW4PKIYc7TljogsEHf9Cz/kpEKzqDtsH2LrmjMNsbWiousvNHM+MPgcuMg8ZnwLKwDy9NWdI4XLTpg6hVRJNH9erZdfAO5tg/3ub3JLeJbyNo4Bd5f/Bnr5YN/9ahZ87kSpI7v0Qk94dR4hDPjstEcghyZ9RVUoN52+h1g83cd3cIqksJd0kifMCoBmObD013RSPQqNwr9GGU2JaJEm25Vq35dy2DHAkOQpUZVT8GNg9IM4qUDV0yagTN3bZyvuLWIgufb0CAwEAAQ==
|
5
|
+
|
6
|
+
0001;2018-01-01T01:01:01Z;fffffff700000000;helloyou;abcdabcdabcdabcd;for fun;Mx86AcOsjN8lQ4ugfBCjB1yVNniYPbZCWXWyvYjc00uUmmXt1OumjVJxX6xt127n2VUWEUXZsTmIw5sUtwpkDE1cvIL+jnaxJ5RaGsJsawbm2QRxL8SBiqKRkIm+lzCBrARe06K5GUaMkOpU9JORfPRr+RuhIbA20KcuD7s2N/aw7R7CLFMNCAljGGe6jKp92LFatnP3nL+y4b3TL8IGlWKFCdf3q+Ng9f+9pj8CMjzTCUapvWt55Gzol7+Fge5Jj+6OwdjqJavxDtPgjz/ZdXxl+jrigL7A0RU+xsqwzP8cXkGXJZjilesoy0uoExHsyP+xSmrIbJE1dVGZX+EglMym4wnlm7Nn2R0MIjQ9JOTSE+nlAUjsXiO7zJ3qvQvpZh0VV3TsSOOtvTGksPAGAYTpkvtlHB/4ptl8yI6abz2qeD3rtZeL3uXKhz1Xy6NWKjX/of/xeqkI/bfHE+OkUmjVOzBlQIgws/ibKkawqeR/GkA7ZKIizsDdOdcVIdWZQIlguILNgB4VWsr+zxpwdliYQA1j9DLSNkAu2E329v63TTXJVOBV4tQIVaiPW+D0T4fSoDdF1G/+uIrD0OEnQDATzT1M2fF/xkwnUYS1nBZUkhVvVRXtAHIcAzFpoeQL0iUS5HKip4mxfpb8qrozP8mPD6Uq9aiTNuzPtxi2NN4=
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2018-2019 Zerocracy, Inc.
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require_relative 'asserts.rb'
|
24
|
+
wallet = Zold::Wallet.new('0123456789abcdef.z')
|
25
|
+
assert_equal(Zold::Amount.new(zld: -9.0), wallet.balance)
|
@@ -0,0 +1,6 @@
|
|
1
|
+
test
|
2
|
+
2
|
3
|
+
0123456789abcdef
|
4
|
+
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnppnkzrCreiKaHF09XKS6bO+2274+wSGo+F8KHvVrNbqear/e09r9PB/P6bFdLoMh4Xc7p/7+NSEZLeu2Eg/dBkQLEb8M/zgkT4gBDGyETW/zusYHIznX/lgf0f8qleIQIIB/3Y7QpDztkamWYTKWlnmlrcQvCVB0uRRPm4ZMcMJouKR9n7E2DpL9eolKyOwr/JY08iJOuK3HuW6tRdvE+0x7I+wDprM65OH/PoArlfO5qnIGbeXwsEGRXt0w6a/ubPpeadFjPXotE7cT1SA4YSD1tWTIVm1ZWppOE967XoDIum6tzt5KfzDNRfs9GbCfO0BL235HxbO8I9rTlVLTKcNAiEe0CWolY9HR5pMaosOgZ6PB54InJEZJs4L2b10c+IlVUX1RSnwfFYg0vy5oqrYyqt7gnipl/06YW4PKIYc7TljogsEHf9Cz/kpEKzqDtsH2LrmjMNsbWiousvNHM+MPgcuMg8ZnwLKwDy9NWdI4XLTpg6hVRJNH9erZdfAO5tg/3ub3JLeJbyNo4Bd5f/Bnr5YN/9ahZ87kSpI7v0Qk94dR4hDPjstEcghyZ9RVUoN52+h1g83cd3cIqksJd0kifMCoBmObD013RSPQqNwr9GGU2JaJEm25Vq35dy2DHAkOQpUZVT8GNg9IM4qUDV0yagTN3bZyvuLWIgufb0CAwEAAQ==
|
5
|
+
|
6
|
+
0001;2019-01-30T17:38:07Z;ffffffce00000000;helloyou;abcdabcdabcdabcd;for fun;MVRb2v82hcujyKi2s6b8TePpzupfJ67PnYGau33b8dXBsLRjDX2Ttm+m1ieZLqB9lcaIDr3XKMG/tZEnz6kj6w4Ya6jryt8XHo/9ae2LRSa83aa6LjXJmb5mroKiwpQeFPqojY2mDRnr7FvERi4ctbYvu6l+bDdgX/zp2epK8lGToPHO6Hl4j1aTEOWBmm9KDSRKsRWfJJvC01wz71o3S4vDiH+LTLw21Ymw9nb4tXGXt8nG2mjJO0UcwJsLkMBv9yk4UHXbHlo1BXg+FyJr26ICXgW7ooCgOWNhc782IMoKAE2ZH2tLKvOO5ceNx5QjQ8dL2gjAbBo2MlZeXs9YAOaf+B5+Po+lkxiESMZm5/u8+T8H3BwZHEq+u/IS2AbSkwFwtHSWqSw2t+xhrDViUqPv8cYwFTgl0mNdTbfi9qL7US/Lo3iJhUKskwfhkDjnfl2ukfvQ1sU3hfarfT6RV/PfZigLqTqdBq5h+qmPdCdSdNg2QXXeCZUslLzXVtFfMHYHQYLlK4B3Ih9rGhuXqVxLL67K4AdoT+BhIhod27DcQrIro1CvtjoRKQxTcsXgDeMkGDczLrqu8FCsHXPRSAoAuBj+kx+GzPAhQf9YVjX1KOFzb/HEnJd7oT6FYRaurHumXHtxzVf3986+KIc4eqkOvuDetwsWD+htkDsNBBg=
|
@@ -0,0 +1 @@
|
|
1
|
+
1,0.0.0.0,4096,10,NOW,M
|
data/lib/zold/commands/merge.rb
CHANGED
@@ -53,9 +53,6 @@ module Zold
|
|
53
53
|
opts = Slop.parse(args, help: true, suppress_errors: true) do |o|
|
54
54
|
o.banner = "Usage: zold merge [ID...] [options]
|
55
55
|
Available options:"
|
56
|
-
o.bool '--no-baseline',
|
57
|
-
'Don\'t trust any remote copies and re-validate all incoming payments against their wallets',
|
58
|
-
default: false
|
59
56
|
o.bool '--skip-propagate',
|
60
57
|
'Don\'t propagate after merge',
|
61
58
|
default: false
|
@@ -94,15 +91,17 @@ Available options:"
|
|
94
91
|
@wallets.acq(id) do |w|
|
95
92
|
if w.exists?
|
96
93
|
s = Time.now
|
97
|
-
|
98
|
-
@log.debug("Local
|
94
|
+
patch.legacy(w)
|
95
|
+
@log.debug("Local copy of #{id} merged legacy in #{Age.new(s)}: #{patch}")
|
96
|
+
else
|
97
|
+
@log.debug("There is no local copy to merge legacy of #{id}")
|
99
98
|
end
|
100
99
|
end
|
101
100
|
end
|
102
101
|
cps.each_with_index do |c, idx|
|
103
102
|
wallet = Wallet.new(c[:path])
|
104
103
|
name = "#{c[:name]}/#{idx}/#{c[:score]}"
|
105
|
-
merge_one(opts, patch, wallet, name
|
104
|
+
merge_one(opts, patch, wallet, name)
|
106
105
|
score += c[:score]
|
107
106
|
end
|
108
107
|
@wallets.acq(id) do |w|
|
@@ -125,11 +124,13 @@ into #{@wallets.acq(id, &:mnemo)} in #{Age.new(start, limit: 0.1 + cps.count * 0
|
|
125
124
|
modified
|
126
125
|
end
|
127
126
|
|
128
|
-
def merge_one(opts, patch, wallet, name
|
127
|
+
def merge_one(opts, patch, wallet, name)
|
129
128
|
start = Time.now
|
130
129
|
@log.debug("Building a patch for #{wallet.id} from remote copy ##{name} with #{wallet.mnemo}...")
|
131
|
-
|
132
|
-
|
130
|
+
if opts['shallow']
|
131
|
+
patch.join(wallet)
|
132
|
+
else
|
133
|
+
patch.join(wallet) do |id|
|
133
134
|
Pull.new(wallets: @wallets, remotes: @remotes, copies: @copies, log: @log).run(
|
134
135
|
['pull', id.to_s, "--network=#{opts['network']}", '--shallow']
|
135
136
|
)
|
data/lib/zold/commands/pay.rb
CHANGED
@@ -60,6 +60,9 @@ Available options:"
|
|
60
60
|
o.bool '--force',
|
61
61
|
'Ignore all validations',
|
62
62
|
default: false
|
63
|
+
o.string '--time',
|
64
|
+
"Time of transaction (default: #{Time.now.utc.iso8601})",
|
65
|
+
default: Time.now.utc.iso8601
|
63
66
|
o.bool '--tolerate-edges',
|
64
67
|
'Don\'t fail if only "edge" (not "master" ones) nodes have the wallet',
|
65
68
|
default: false
|
@@ -121,7 +124,7 @@ Available options:"
|
|
121
124
|
end
|
122
125
|
end
|
123
126
|
key = Zold::Key.new(file: opts['private-key'])
|
124
|
-
txn = from.sub(amount, invoice, key, details)
|
127
|
+
txn = from.sub(amount, invoice, key, details, time: Txn.parse_time(opts['time']))
|
125
128
|
@log.debug("#{amount} sent from #{from} to #{txn.bnf}: #{details}")
|
126
129
|
@log.debug("Don't forget to do 'zold push #{from}'")
|
127
130
|
@log.info(txn.id)
|
data/lib/zold/node/entrance.rb
CHANGED
@@ -79,7 +79,7 @@ module Zold
|
|
79
79
|
end
|
80
80
|
modified = Merge.new(
|
81
81
|
wallets: @wallets, remotes: @remotes, copies: copies.root, log: @log
|
82
|
-
).run(['merge', id.to_s
|
82
|
+
).run(['merge', id.to_s])
|
83
83
|
Clean.new(wallets: @wallets, copies: copies.root, log: @log).run(['clean', id.to_s])
|
84
84
|
copies.remove(localhost, Remotes::PORT)
|
85
85
|
if modified.empty?
|
data/lib/zold/patch.rb
CHANGED
@@ -44,22 +44,24 @@ module Zold
|
|
44
44
|
"#{@txns.count} txns"
|
45
45
|
end
|
46
46
|
|
47
|
+
# Add legacy transactions first, since they are negative and can't
|
48
|
+
# be deleted ever. This method is called by merge.rb in order to add
|
49
|
+
# legacy negative transactions to the patch before everything else. They
|
50
|
+
# are not supposed to be disputed, ever.
|
51
|
+
def legacy(wallet, hours: 24)
|
52
|
+
raise 'You can\'t add legacy to a non-empty patch' unless @id.nil?
|
53
|
+
wallet.txns.each do |txn|
|
54
|
+
@txns << txn if txn.amount.negative? && txn.date < Time.now - hours * 60 * 60
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
47
58
|
# Joins a new wallet on top of existing patch. An attempt is made to
|
48
59
|
# copy as many transactions from the newcoming wallet to the existing
|
49
60
|
# set of transactions, avoiding mistakes and duplicates.
|
50
|
-
|
51
|
-
# If +baseline+ is set to TRUE the provided wallet is considered to be
|
52
|
-
# the baseline and all transactions will be blindly trusted.
|
53
|
-
def join(wallet, baseline: true, legacy: false)
|
61
|
+
def join(wallet)
|
54
62
|
if @id.nil?
|
55
63
|
@id = wallet.id
|
56
64
|
@key = wallet.key
|
57
|
-
if baseline
|
58
|
-
@txns = wallet.txns
|
59
|
-
@log.debug("The baseline of #{wallet.id} is #{wallet.balance}/#{@txns.count}t")
|
60
|
-
else
|
61
|
-
@log.debug("The baseline of #{@txns.count} transactions ignored")
|
62
|
-
end
|
63
65
|
@network = wallet.network
|
64
66
|
end
|
65
67
|
unless wallet.network == @network
|
@@ -75,7 +77,6 @@ module Zold
|
|
75
77
|
return
|
76
78
|
end
|
77
79
|
wallet.txns.each do |txn|
|
78
|
-
next if legacy && (txn.amount.positive? || txn.date > Time.now - 24 * 60 * 60)
|
79
80
|
next if @txns.find { |t| t == txn }
|
80
81
|
if txn.amount.negative?
|
81
82
|
dup = @txns.find { |t| t.id == txn.id && t.amount.negative? }
|
@@ -115,16 +116,15 @@ with a new one \"#{txn.to_text}\" from #{wallet.mnemo}")
|
|
115
116
|
@log.error("Paying wallet #{txn.bnf} file is absent even after PULL: \"#{txn.to_text}\"")
|
116
117
|
next
|
117
118
|
end
|
119
|
+
unless @wallets.acq(txn.bnf) { |p| p.includes_negative?(txn.id, wallet.id) }
|
120
|
+
@log.error("The beneficiary #{@wallets.acq(txn.bnf, &:mnemo)} of #{@id} \
|
121
|
+
doesn't have this transaction: \"#{txn.to_text}\"")
|
122
|
+
next
|
123
|
+
end
|
118
124
|
else
|
119
|
-
@log.
|
120
|
-
next
|
125
|
+
@log.debug("Paying wallet #{txn.bnf} file is absent but it's a \"shallow\" MERGE: #{txn.to_text}")
|
121
126
|
end
|
122
127
|
end
|
123
|
-
unless @wallets.acq(txn.bnf) { |p| p.includes_negative?(txn.id, wallet.id) }
|
124
|
-
@log.error("The beneficiary #{@wallets.acq(txn.bnf, &:mnemo)} of #{@id} \
|
125
|
-
doesn't have this transaction: \"#{txn.to_text}\"")
|
126
|
-
next
|
127
|
-
end
|
128
128
|
end
|
129
129
|
@txns << txn
|
130
130
|
@log.debug("Merged on top, balance is #{@txns.map(&:amount).inject(&:+)}: #{txn.to_text}")
|
data/lib/zold/version.rb
CHANGED
data/test/commands/test_merge.rb
CHANGED
@@ -25,6 +25,7 @@ require 'tmpdir'
|
|
25
25
|
require 'time'
|
26
26
|
require 'webmock/minitest'
|
27
27
|
require 'zold/score'
|
28
|
+
require 'English'
|
28
29
|
require_relative '../test__helper'
|
29
30
|
require_relative '../fake_home'
|
30
31
|
require_relative '../../lib/zold/wallet'
|
@@ -131,15 +132,16 @@ class TestMerge < Zold::Test
|
|
131
132
|
key = Zold::Key.new(file: 'fixtures/id_rsa')
|
132
133
|
wallet.sub(Zold::Amount.new(zld: 9.99), "NOPREFIX@#{Zold::Id.new}", key)
|
133
134
|
Zold::Merge.new(wallets: home.wallets, remotes: home.remotes, copies: home.copies.root, log: test_log).run(
|
134
|
-
['merge', wallet.id.to_s
|
135
|
+
['merge', wallet.id.to_s]
|
135
136
|
)
|
136
137
|
assert_equal(Zold::Amount::ZERO, wallet.balance)
|
137
138
|
end
|
138
139
|
end
|
139
140
|
|
140
|
-
|
141
|
-
|
142
|
-
|
141
|
+
base = 'fixtures/merge'
|
142
|
+
Dir.new(base).select { |f| File.directory?(File.join(base, f)) && !f.start_with?('.') }.each do |f|
|
143
|
+
method = "test_#{f}"
|
144
|
+
define_method(method) do
|
143
145
|
Dir.mktmpdir do |dir|
|
144
146
|
FileUtils.cp_r(File.join('fixtures/merge', "#{f}/."), dir)
|
145
147
|
scores = File.join(dir, "copies/0123456789abcdef/scores#{Zold::Copies::EXT}")
|
@@ -152,7 +154,6 @@ class TestMerge < Zold::Test
|
|
152
154
|
%w[merge 0123456789abcdef --shallow]
|
153
155
|
)
|
154
156
|
Dir.chdir(dir) do
|
155
|
-
test_log.info("Testing #{f}...")
|
156
157
|
require File.join(dir, 'assert.rb')
|
157
158
|
end
|
158
159
|
end
|
data/test/test_patch.rb
CHANGED
@@ -26,6 +26,7 @@ require_relative 'test__helper'
|
|
26
26
|
require_relative '../lib/zold/key'
|
27
27
|
require_relative '../lib/zold/id'
|
28
28
|
require_relative '../lib/zold/wallet'
|
29
|
+
require_relative '../lib/zold/prefixes'
|
29
30
|
require_relative '../lib/zold/amount'
|
30
31
|
require_relative '../lib/zold/patch'
|
31
32
|
|
@@ -52,8 +53,7 @@ class TestPatch < Zold::Test
|
|
52
53
|
patch.join(first)
|
53
54
|
patch.join(second)
|
54
55
|
patch.join(third)
|
55
|
-
|
56
|
-
assert_equal(true, patch.save(first.path))
|
56
|
+
assert_equal(true, patch.save(first.path, overwrite: true))
|
57
57
|
assert_equal(Zold::Amount.new(zld: -53.0), first.balance)
|
58
58
|
end
|
59
59
|
end
|
@@ -67,8 +67,8 @@ class TestPatch < Zold::Test
|
|
67
67
|
patch = Zold::Patch.new(home.wallets, log: test_log)
|
68
68
|
patch.join(first)
|
69
69
|
patch.join(second)
|
70
|
-
|
71
|
-
|
70
|
+
assert_equal(false, patch.save(first.path, overwrite: true))
|
71
|
+
first.flush
|
72
72
|
assert_equal(Zold::Amount::ZERO, first.balance)
|
73
73
|
end
|
74
74
|
end
|
@@ -84,8 +84,8 @@ class TestPatch < Zold::Test
|
|
84
84
|
patch = Zold::Patch.new(home.wallets, log: test_log)
|
85
85
|
patch.join(first)
|
86
86
|
patch.join(second)
|
87
|
-
|
88
|
-
|
87
|
+
assert_equal(true, patch.save(first.path, overwrite: true))
|
88
|
+
first.flush
|
89
89
|
assert_equal(amount * -1, first.balance)
|
90
90
|
end
|
91
91
|
end
|
@@ -97,13 +97,18 @@ class TestPatch < Zold::Test
|
|
97
97
|
IO.write(second.path, IO.read(first.path))
|
98
98
|
key = Zold::Key.new(file: 'fixtures/id_rsa')
|
99
99
|
second.sub(Zold::Amount.new(zld: 7.0), "NOPREFIX@#{Zold::Id.new}", key)
|
100
|
-
first.add(
|
100
|
+
first.add(
|
101
|
+
Zold::Txn.new(
|
102
|
+
1, Time.now, Zold::Amount.new(zld: 9.0),
|
103
|
+
Zold::Prefixes.new(first).create, Zold::Id.new, 'fake'
|
104
|
+
)
|
105
|
+
)
|
101
106
|
patch = Zold::Patch.new(home.wallets, log: test_log)
|
102
107
|
patch.join(first)
|
103
108
|
patch.join(second)
|
104
|
-
|
105
|
-
|
106
|
-
assert_equal(Zold::Amount.new(zld: 2.0), first.balance)
|
109
|
+
assert_equal(true, patch.save(first.path, overwrite: true))
|
110
|
+
first.flush
|
111
|
+
assert_equal(Zold::Amount.new(zld: 2.0).to_s, first.balance.to_s)
|
107
112
|
end
|
108
113
|
end
|
109
114
|
|
@@ -135,9 +140,10 @@ class TestPatch < Zold::Test
|
|
135
140
|
patch = Zold::Patch.new(home.wallets, log: test_log)
|
136
141
|
patch.join(first)
|
137
142
|
patch.join(second)
|
138
|
-
|
139
|
-
|
140
|
-
assert_equal(
|
143
|
+
assert_equal(true, patch.save(first.path, overwrite: true))
|
144
|
+
first.flush
|
145
|
+
assert_equal(3, first.txns.count)
|
146
|
+
assert_equal(Zold::Amount.new(zld: -6.0).to_s, first.balance.to_s)
|
141
147
|
end
|
142
148
|
end
|
143
149
|
end
|
@@ -39,7 +39,7 @@ module Zold
|
|
39
39
|
f = File.join(@home, path)
|
40
40
|
wallet = Wallet.new(f)
|
41
41
|
next if wallet.network == @network
|
42
|
-
@log.info("Wallet #{wallet.id} #{Rainbow(renamed).red}, \
|
42
|
+
@log.info("Wallet #{wallet.id} #{Rainbow('renamed').red}, \
|
43
43
|
since it's in \"#{wallet.network}\", while we are in \"#{@network}\" network")
|
44
44
|
File.rename(f, f + '-old')
|
45
45
|
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.22.
|
4
|
+
version: 0.22.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
@@ -574,6 +574,10 @@ files:
|
|
574
574
|
- fixtures/merge/into-no-wallet/assert.rb
|
575
575
|
- fixtures/merge/into-no-wallet/copies/0123456789abcdef/1.zc
|
576
576
|
- fixtures/merge/into-no-wallet/copies/0123456789abcdef/scores.zc
|
577
|
+
- fixtures/merge/legacy-negatives-stay/0123456789abcdef.z
|
578
|
+
- fixtures/merge/legacy-negatives-stay/assert.rb
|
579
|
+
- fixtures/merge/legacy-negatives-stay/copies/0123456789abcdef/1.zc
|
580
|
+
- fixtures/merge/legacy-negatives-stay/copies/0123456789abcdef/scores.zc
|
577
581
|
- fixtures/merge/random-expenses/0000000000000000.z
|
578
582
|
- fixtures/merge/random-expenses/0123456789abcdef.z
|
579
583
|
- fixtures/merge/random-expenses/assert.rb
|
@@ -747,7 +751,7 @@ licenses:
|
|
747
751
|
- MIT
|
748
752
|
metadata: {}
|
749
753
|
post_install_message: |-
|
750
|
-
Thanks for installing Zold 0.22.
|
754
|
+
Thanks for installing Zold 0.22.7!
|
751
755
|
Study our White Paper: https://papers.zold.io/wp.pdf
|
752
756
|
Read our blog posts: https://blog.zold.io
|
753
757
|
Try ZLD online wallet at: https://wts.zold.io
|