zold 0.14.20 → 0.14.21

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5cc5d6a70ba9da35b51e3c34a1493eb1e8f2c112
4
- data.tar.gz: 468fc5a611aeaa7849256c814091d2a5e83b55ec
3
+ metadata.gz: a178783c0061e8ea31d65d43de478c40d7c128db
4
+ data.tar.gz: 9ee344f9c6edf0b74445432ec368537582396d6f
5
5
  SHA512:
6
- metadata.gz: 6b30088ce0a2f52dee378b440615af6c0748269c4528076dbd9085752c2afd957472b83e0a6316f2123a829e4aa40c23eeb06ce7e54419899e92c74bb1ea6e0e
7
- data.tar.gz: '09b9ca12f2121bc6297f4f5bae6373e4a7fa741367b839ce04ce65dc54d24c8340196817940179d4b0daa1722726574a808e1b9a1fa51afcce30e2714290532c'
6
+ metadata.gz: 859e4812c38e52e6c25e6f59ebe637f4fd17df734a2ca33698401c6e813bf90e93e476504f5c982e32ae3636e7588416acd1b2c8ee3d1299534d7ddf66c8b158
7
+ data.tar.gz: 440f5e22bb4b7d5e5011ca8dd40aaf3beb179ff24798e606e29275c6f204cd4a17b59d248334acfef4e176befa1a6dac24d4b0befc31e19d09f7196d7c43e070
data/lib/zold/tax.rb CHANGED
@@ -77,15 +77,16 @@ module Zold
77
77
 
78
78
  def debt
79
79
  txns = @wallet.txns
80
- scores = txns.map do |t|
80
+ scored = txns.map do |t|
81
81
  pfx, body = t.details.split(' ', 2)
82
82
  next if pfx != Tax::PREFIX || body.nil?
83
83
  score = Score.parse_text(body)
84
84
  next if !score.valid? || score.value != Tax::EXACT_SCORE
85
+ next if score.strength < Score::STRENGTH
85
86
  next if t.amount > Tax::MAX_PAYMENT
86
87
  score
87
- end.reject(&:nil?).uniq(&:hash)
88
- paid = scores.empty? ? Amount::ZERO : scores.map(&:amount).inject(&:+) * -1
88
+ end.reject(&:nil?).uniq(&:sign)
89
+ paid = scored.empty? ? Amount::ZERO : scored.map(&:amount).inject(&:+) * -1
89
90
  owned = Tax::FEE_TXN_HOUR * txns.count * @wallet.age
90
91
  owned - paid
91
92
  end
data/lib/zold/version.rb CHANGED
@@ -25,6 +25,6 @@
25
25
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Zold
28
- VERSION = '0.14.20'
28
+ VERSION = '0.14.21'
29
29
  PROTOCOL = 2
30
30
  end
data/lib/zold/wallet.rb CHANGED
@@ -117,7 +117,7 @@ module Zold
117
117
  details
118
118
  )
119
119
  txn = txn.signed(pvt, id)
120
- raise 'This is not the private right key for this wallet' unless Signature.new.valid?(key, id, txn)
120
+ raise 'This is not the right private key for this wallet' unless Signature.new.valid?(key, id, txn)
121
121
  add(txn)
122
122
  txn
123
123
  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.14.20
4
+ version: 0.14.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko