zold 0.29.21 → 0.29.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b0d7ac8dd66157373eb07294a099889a0bc0473f641f50d162179889e525fcb
4
- data.tar.gz: 9cb56fc29fccb99b770ad25c9b1a4ffcaaf590c5534482d5e5b558cd73db7f8b
3
+ metadata.gz: 5b4542141ab23f1369c77e16a27e14999b91d20fc7d9a44e15951cdae5cefa41
4
+ data.tar.gz: ff130bde3e777a600141445f1367cc3f0738d870887591f890e49b8171e14846
5
5
  SHA512:
6
- metadata.gz: af0e8a298e25443b4d8583f3aff9c2df2da048d2d7842f7d3b5d665dbcee71131d1e42927c4d7b5f03a54097bc9d31fdbd05ccbe30eac08f92a223c1986dcc9e
7
- data.tar.gz: 5067cdd096e87664e678cbe3bc9f152e1d835a6a9498d78b55d86ad59f004f9e051ed3218e007634fdd397d9c2318032d949c46e5940354c8107863e05be6be8
6
+ metadata.gz: 17f943b32fd7d8d2a9140cd4a2212573e2f90afd9a7b59a539d3550f5861f1c7fd0addf89f2eac16b493d78049bddc1e382b342d65b0375e2e6648750b17ceb4
7
+ data.tar.gz: 961b59b291f64b5d4369f5191a07809528198d47a502212b8461c7c87bd4f849e60f71e1944aa6279a5f5d3085f02ef9dead8324b979f569adce40bed2a132ab
@@ -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
@@ -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
@@ -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
- if txn.amount.negative?
134
- File.open(ledger, 'a') do |f|
135
- f.puts(
136
- [
137
- Time.now.utc.iso8601,
138
- txn.id,
139
- txn.date.utc.iso8601,
140
- wallet.id,
141
- txn.bnf,
142
- txn.amount.to_i * -1,
143
- txn.prefix,
144
- txn.details
145
- ].map(&:to_s).join(';') + "\n"
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?
@@ -25,7 +25,7 @@
25
25
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Zold
28
- VERSION = '0.29.21'
28
+ VERSION = '0.29.22'
29
29
  PROTOCOL = 2
30
30
  REPO = 'zold-io/zold'
31
31
  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.29.21
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.21!
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