lib/bitcoin/storage/storage.rb in bitcoin-ruby-0.0.2 vs lib/bitcoin/storage/storage.rb in bitcoin-ruby-0.0.3

- old
+ new

@@ -274,28 +274,27 @@ # compute blockchain locator def get_locator pointer = get_head if @locator locator, head = @locator - if head == get_head + if head == pointer return locator end end return [("\x00"*32).hth] if get_depth == -1 - locator = [] - step = 1 + locator, step, orig_pointer = [], 1, pointer while pointer && pointer.hash != Bitcoin::network[:genesis_hash] locator << pointer.hash depth = pointer.depth - step break unless depth > 0 prev_block = get_block_by_depth(depth) # TODO break unless prev_block pointer = prev_block step *= 2 if locator.size > 10 end locator << Bitcoin::network[:genesis_hash] - @locator = [locator, get_head] + @locator = [locator, orig_pointer] locator end # get block with given +blk_hash+ def get_block(blk_hash)