Commit f0b5bca7da0d388311df37ce9f81473a5c7beefa

Authored by Marius Hanne
1 parent 34db910b31
Exists in master and in 1 other branch benchmark

use storage config instead of asking to build tx.nhash index during migrations

Showing 1 changed file with 8 additions and 11 deletions Side-by-side Diff

lib/bitcoin/storage/sequel/migrations/006_add_tx_nhash.rb
... ... @@ -11,23 +11,20 @@
11 11 end
12 12 end
13 13  
14   - if $stdin.tty?
15   - print "Do you want to build an index for normalized tx hashes? (~1GB) (y/N) "
16   - if $0 =~ /spec/ || $stdin.gets.chomp == "y"
17   - puts "Building normalized hash index..."
  14 + if @store.config[:index_nhash]
  15 + puts "Building normalized hash index..."
18 16  
19   - add_column :tx, :nhash, :bytea
  17 + add_column :tx, :nhash, :bytea
20 18  
21   - if blk = @store.get_block_by_depth(0)
  19 + if blk = @store.get_block_by_depth(0)
  20 + process_block(blk)
  21 + while blk = blk.get_next_block
22 22 process_block(blk)
23   - while blk = blk.get_next_block
24   - process_block(blk)
25   - end
26 23 end
  24 + end
27 25  
28   - add_index :tx, :nhash
  26 + add_index :tx, :nhash
29 27  
30   - end
31 28 end
32 29 end
33 30