def update_blocknumbers(blk)
      loop do
        if blk.number > 0
          @db.put_temporarily block_by_number_key(blk.number), blk.full_hash
        else
          @db.put block_by_number_key(blk.number), blk.full_hash
        end
        @db.commit_refcount_changes blk.number

        break if blk.number == 0

        blk = blk.get_parent()
        break if has_block_by_number(blk.number) && get_block_by_number(blk.number) == blk.full_hash
      end
    end
def update_blocknumbers(blk)
      loop do
        if blk.number > 0
          @db.put_temporarily block_by_number_key(blk.number), blk.full_hash
        else
          @db.put block_by_number_key(blk.number), blk.full_hash
        end
        @db.commit_refcount_changes blk.number

        break if blk.number == 0

        blk = blk.get_parent()
        break if has_block_by_number(blk.number) && get_block_by_number(blk.number) == blk.full_hash
      end
    end
def update_blocknumbers ( blk ) loop do if blk . number > 0 @db . put_temporarily block_by_number_key ( blk . number ) , blk . full_hash else @db . put block_by_number_key ( blk . number ) , blk . full_hash end @db . commit_refcount_changes blk . number break if blk . number == 0 blk = blk . get_parent ( ) break if has_block_by_number ( blk . number ) && get_block_by_number ( blk . number ) == blk . full_hash end end
start from head and update until the existing indices match the block
start from head and update until the existing indices match the block