zold 0.26.9 → 0.26.10

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: 85d9fc57dbc5cf31bd7385e08c64d8b16332a52a0daf40c937eafdea24486178
4
- data.tar.gz: 1a88657cb0fec082013f4755f268bfe6bae02cc4528a4c5cc619449efca6c557
3
+ metadata.gz: c0eb2f544daa848545dbc287811d8bf14a3d691dbcb63bdf947c53660be7c7f0
4
+ data.tar.gz: 6126407c380aaf900613521f39feb4ae3af39e1badb6824aed3691fbcabbe800
5
5
  SHA512:
6
- metadata.gz: e009c0adc7c03edb2bb4abc707376ff22bd32a67cf4396e37a382e7e88ff0feab5cc2cd2a3890b7fb39e24853fe2079d2a42c0cb74652f11df735cd6c01400e1
7
- data.tar.gz: 8d79089a31eaa999510c1be34d0fa22adcc80b6fe35b95772a07f7c265b097b9af0b154888c314fb9ba19cabf75aba689db1fc5d913cf3111f3899d775fc9df5
6
+ metadata.gz: 07e2cf7c0014c54bdacbf31b7efe09d71224e4305953f24282b8568e8b8a0b3dcb748fb3ff14dfe4a8b7152d150a44903b18976f4aff19bfebc011d043860d22
7
+ data.tar.gz: 5a8f701777875c91cb072ff8d97eee4790365d0338a0c5760780d8d6e5e873681db6e78212b8ef07b990cca4b56b7c3f5b02f065d9045aa82f388aa242060749
data/bin/zold CHANGED
@@ -168,7 +168,11 @@ log.debug("Home directory: #{home}")
168
168
  zdata = File.join(home, '.zoldata')
169
169
 
170
170
  unless opts['skip-upgrades']
171
- Zold::Upgrades.new(Zold::VersionFile.new(File.join(zdata, 'version')), 'upgrades', { command: command, network: opts['network']}).run
171
+ Zold::Upgrades.new(
172
+ Zold::VersionFile.new(File.join(zdata, 'version')),
173
+ 'upgrades',
174
+ { command: command, network: opts['network']}
175
+ ).run
172
176
  end
173
177
 
174
178
  locks = File.join(zdata, 'locks')
data/lib/zold/upgrades.rb CHANGED
@@ -37,17 +37,18 @@ module Zold
37
37
  Dir.glob("#{@directory}/*.rb").select { |f| f =~ /^(\d+)\.rb$/ }.sort.each do |script|
38
38
  @version.apply(script)
39
39
  end
40
-
41
40
  command = @opts[:command]
41
+ require_relative '../../upgrades/delete_banned_wallets'
42
+ DeleteBannedWallets.new(Dir.pwd, @log).exec
42
43
  require_relative '../../upgrades/2'
43
- Zold::UpgradeTo2.new(Dir.pwd, @log).exec
44
+ UpgradeTo2.new(Dir.pwd, @log).exec
44
45
  require_relative '../../upgrades/protocol_up'
45
- Zold::ProtocolUp.new(Dir.pwd, @log).exec
46
+ ProtocolUp.new(Dir.pwd, @log).exec
46
47
  require_relative '../../upgrades/rename_foreign_wallets'
47
- Zold::RenameForeignWallets.new(Dir.pwd, @opts[:network], @log).exec
48
+ RenameForeignWallets.new(Dir.pwd, @opts[:network], @log).exec
48
49
  return unless command == 'node'
49
50
  require_relative '../../upgrades/move_wallets_into_tree'
50
- Zold::MoveWalletsIntoTree.new(Dir.pwd, @log).exec
51
+ MoveWalletsIntoTree.new(Dir.pwd, @log).exec
51
52
  end
52
53
  end
53
54
  end
data/lib/zold/version.rb CHANGED
@@ -25,7 +25,7 @@
25
25
  # Copyright:: Copyright (c) 2018 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Zold
28
- VERSION = '0.26.9'
28
+ VERSION = '0.26.10'
29
29
  PROTOCOL = 2
30
30
  REPO = 'zold-io/zold'
31
31
  end
@@ -0,0 +1,47 @@
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 'minitest/autorun'
24
+ require_relative '../test__helper'
25
+ require_relative '../../lib/zold/id'
26
+ require_relative '../../upgrades/delete_banned_wallets'
27
+ require_relative '../fake_home'
28
+
29
+ # Delete banned wallets.
30
+ # Author:: Yegor Bugayenko (yegor256@gmail.com)
31
+ # Copyright:: Copyright (c) 2018 Yegor Bugayenko
32
+ # License:: MIT
33
+ class TestDeleteBannedWallets < Zold::Test
34
+ def test_delete_them
35
+ id = Zold::Id.new(CSV.read(File.join(__dir__, '../../resources/banned-wallets.csv'))[0][0])
36
+ FakeHome.new(log: test_log).run do |home|
37
+ home.create_wallet(id)
38
+ FileUtils.mkdir_p(File.join(home.dir, 'a/b/c'))
39
+ File.rename(
40
+ File.join(home.dir, "#{id}#{Zold::Wallet::EXT}"),
41
+ File.join(home.dir, "a/b/c/#{id}#{Zold::Wallet::EXT}")
42
+ )
43
+ Zold::DeleteBannedWallets.new(home.dir, test_log).exec
44
+ assert(File.exist?(File.join(home.dir, "a/b/c/#{id}#{Zold::Wallet::EXT}-banned")))
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,48 @@
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 'rainbow'
24
+ require_relative '../lib/zold/version'
25
+ require_relative '../lib/zold/wallet'
26
+
27
+ module Zold
28
+ # Delete wallets which are in the banned-wallets.csv file
29
+ class DeleteBannedWallets
30
+ def initialize(home, log)
31
+ @home = home
32
+ @log = log
33
+ end
34
+
35
+ def exec
36
+ banned = IO.read(File.join(__dir__, '../resources/banned-wallets.csv'))
37
+ DirItems.new(@home).fetch.each do |path|
38
+ name = File.basename(path)
39
+ next unless name =~ /^[a-f0-9]{16}#{Wallet::EXT}$/
40
+ id = name[0..15]
41
+ next unless banned.include?("\"#{id}\"")
42
+ path = File.join(@home, path)
43
+ File.rename(path, path + '-banned')
44
+ @log.info("Wallet file #{path} renamed, since wallet #{id} is banned")
45
+ end
46
+ end
47
+ end
48
+ 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.26.9
4
+ version: 0.26.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
@@ -759,8 +759,10 @@ files:
759
759
  - test/test_wallet.rb
760
760
  - test/test_wallets.rb
761
761
  - test/test_zold.rb
762
+ - test/upgrades/test_delete_banned_wallets.rb
762
763
  - test/upgrades/test_protocol_up.rb
763
764
  - upgrades/2.rb
765
+ - upgrades/delete_banned_wallets.rb
764
766
  - upgrades/move_wallets_into_tree.rb
765
767
  - upgrades/protocol_up.rb
766
768
  - upgrades/rename_foreign_wallets.rb
@@ -770,7 +772,7 @@ licenses:
770
772
  - MIT
771
773
  metadata: {}
772
774
  post_install_message: |-
773
- Thanks for installing Zold 0.26.9!
775
+ Thanks for installing Zold 0.26.10!
774
776
  Study our White Paper: https://papers.zold.io/wp.pdf
775
777
  Read our blog posts: https://blog.zold.io
776
778
  Try ZLD online wallet at: https://wts.zold.io
@@ -869,4 +871,5 @@ test_files:
869
871
  - test/test_wallet.rb
870
872
  - test/test_wallets.rb
871
873
  - test/test_zold.rb
874
+ - test/upgrades/test_delete_banned_wallets.rb
872
875
  - test/upgrades/test_protocol_up.rb