zold 0.29.21 → 0.29.22
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/clean.rb +1 -1
- data/lib/zold/node/journaled_pipeline.rb +2 -0
- data/lib/zold/node/pipeline.rb +1 -1
- data/lib/zold/patch.rb +23 -17
- data/lib/zold/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b4542141ab23f1369c77e16a27e14999b91d20fc7d9a44e15951cdae5cefa41
|
4
|
+
data.tar.gz: ff130bde3e777a600141445f1367cc3f0738d870887591f890e49b8171e14846
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17f943b32fd7d8d2a9140cd4a2212573e2f90afd9a7b59a539d3550f5861f1c7fd0addf89f2eac16b493d78049bddc1e382b342d65b0375e2e6648750b17ceb4
|
7
|
+
data.tar.gz: 961b59b291f64b5d4369f5191a07809528198d47a502212b8461c7c87bd4f849e60f71e1944aa6279a5f5d3085f02ef9dead8324b979f569adce40bed2a132ab
|
data/lib/zold/commands/clean.rb
CHANGED
@@ -70,7 +70,7 @@ Available options:"
|
|
70
70
|
|
71
71
|
def clean(cps, opts)
|
72
72
|
start = Time.now
|
73
|
-
deleted = cps.clean(max: opts['max-age'])
|
73
|
+
deleted = cps.clean(max: opts['max-age'] * 60 * 60)
|
74
74
|
list = cps.all.map do |c|
|
75
75
|
wallet = Wallet.new(c[:path])
|
76
76
|
"#{c[:name]}: #{c[:score]} #{wallet.mnemo} \
|
@@ -22,6 +22,7 @@
|
|
22
22
|
|
23
23
|
require 'tempfile'
|
24
24
|
require 'diffy'
|
25
|
+
require 'fileutils'
|
25
26
|
require_relative 'pipeline'
|
26
27
|
require_relative '../log'
|
27
28
|
require_relative '../age'
|
@@ -88,6 +89,7 @@ module Zold
|
|
88
89
|
jlog.info("Zold gem version: #{Zold::VERSION}")
|
89
90
|
modified = @pipeline.push(id, body, JournaledPipeline::Wallets.new(wallets, jlog), Log::Tee.new(log, jlog))
|
90
91
|
jlog.info("push(#{id}): done")
|
92
|
+
FileUtils.mv(journal, journal + '-done')
|
91
93
|
modified
|
92
94
|
end
|
93
95
|
end
|
data/lib/zold/node/pipeline.rb
CHANGED
@@ -89,7 +89,7 @@ module Zold
|
|
89
89
|
modified = Tempfile.open do |t|
|
90
90
|
Merge.new(wallets: wallets, remotes: @remotes, copies: copies.root, log: log).run(
|
91
91
|
['merge', id.to_s, "--ledger=#{Shellwords.escape(f.path)}"] +
|
92
|
-
["--trusted=#{Shellwords.escape(t.path)}", '--deep'] +
|
92
|
+
["--trusted=#{Shellwords.escape(t.path)}", '--deep', '--trusted-max=256'] +
|
93
93
|
["--network=#{Shellwords.escape(@network)}"]
|
94
94
|
)
|
95
95
|
end
|
data/lib/zold/patch.rb
CHANGED
@@ -85,6 +85,7 @@ module Zold
|
|
85
85
|
end
|
86
86
|
seen = 0
|
87
87
|
added = 0
|
88
|
+
pulled = []
|
88
89
|
wallet.txns.each do |txn|
|
89
90
|
next if @txns.find { |t| t == txn }
|
90
91
|
seen += 1
|
@@ -114,12 +115,20 @@ with a new one \"#{txn.to_text}\" from #{wallet.mnemo}")
|
|
114
115
|
next
|
115
116
|
end
|
116
117
|
unless @wallets.acq(txn.bnf, &:exists?)
|
118
|
+
next if pulled.include?(txn.bnf)
|
119
|
+
pulled << txn.bnf
|
117
120
|
if yield(txn) && !@wallets.acq(txn.bnf, &:exists?)
|
118
121
|
@log.error("Paying wallet #{txn.bnf} file is absent even after PULL: \"#{txn.to_text}\"")
|
119
122
|
next
|
120
123
|
end
|
121
124
|
end
|
122
125
|
if @wallets.acq(txn.bnf, &:exists?) && !@wallets.acq(txn.bnf) { |p| p.includes_negative?(txn.id, wallet.id) }
|
126
|
+
if pulled.include?(txn.bnf)
|
127
|
+
@log.debug("The beneficiary #{@wallets.acq(txn.bnf, &:mnemo)} of #{@id} \
|
128
|
+
doesn't have this transaction: \"#{txn.to_text}\"")
|
129
|
+
next
|
130
|
+
end
|
131
|
+
pulled << txn.bnf
|
123
132
|
yield(txn)
|
124
133
|
unless @wallets.acq(txn.bnf) { |p| p.includes_negative?(txn.id, wallet.id) }
|
125
134
|
@log.debug("The beneficiary #{@wallets.acq(txn.bnf, &:mnemo)} of #{@id} \
|
@@ -130,25 +139,22 @@ doesn't have this transaction: \"#{txn.to_text}\"")
|
|
130
139
|
end
|
131
140
|
@txns << txn
|
132
141
|
added += 1
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
end
|
142
|
+
next unless txn.amount.negative?
|
143
|
+
File.open(ledger, 'a') do |f|
|
144
|
+
f.puts(
|
145
|
+
[
|
146
|
+
Time.now.utc.iso8601,
|
147
|
+
txn.id,
|
148
|
+
txn.date.utc.iso8601,
|
149
|
+
wallet.id,
|
150
|
+
txn.bnf,
|
151
|
+
txn.amount.to_i * -1,
|
152
|
+
txn.prefix,
|
153
|
+
txn.details
|
154
|
+
].map(&:to_s).join(';') + "\n"
|
155
|
+
)
|
148
156
|
end
|
149
|
-
@log.debug("Merged on top, balance is #{@txns.map(&:amount).inject(&:+)}: #{txn.to_text}")
|
150
157
|
end
|
151
|
-
@log.debug("#{seen} new txns arrived from #{wallet.mnemo}, #{added} of them added to the patch")
|
152
158
|
end
|
153
159
|
|
154
160
|
def empty?
|
data/lib/zold/version.rb
CHANGED
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.29.
|
4
|
+
version: 0.29.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
@@ -798,7 +798,7 @@ licenses:
|
|
798
798
|
- MIT
|
799
799
|
metadata: {}
|
800
800
|
post_install_message: |-
|
801
|
-
Thanks for installing Zold 0.29.
|
801
|
+
Thanks for installing Zold 0.29.22!
|
802
802
|
Study our White Paper: https://papers.zold.io/wp.pdf
|
803
803
|
Read our blog posts: https://blog.zold.io
|
804
804
|
Try ZLD online wallet at: https://wts.zold.io
|