Sha256: b18946615da72eceb081e712bfa2f28b3f5976d9c0b595a37cf90d60e93ebfd2

Contents?: true

Size: 607 Bytes

Versions: 1

Compression:

Stored size: 607 Bytes

Contents

Sequel.migration do

  up do

    @log.info { "Running migration #{__FILE__}" }

    def process_block blk
      print "\r#{blk.hash} - #{blk.depth}"
      blk.tx.each do |tx|
        self[:tx].where(hash: tx.hash.htb.blob).update(nhash: tx.nhash.htb.blob)
      end
    end

    if @store.config[:index_nhash]
      puts "Building normalized hash index..."

      add_column :tx, :nhash, :bytea

      if blk = @store.get_block_by_depth(0)
        process_block(blk)
        while blk = blk.get_next_block
          process_block(blk)
        end
      end

      add_index :tx, :nhash

    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bitcoin-ruby-0.0.6 lib/bitcoin/storage/sequel/migrations/006_add_tx_nhash.rb