#NEWLINE# def block_locator_hashes( self ) : #NEWLINE# #INDENT# 'Return a list of hashes suitable as a block locator hash.' #NEWLINE# hashes = [ ] #NEWLINE# offset = 0 #NEWLINE# cursor = self . _cursor ( ) #NEWLINE# cursor . execute ( 'select hash, height from blocks where mainchain = 1 and height > 0 order by height desc limit 10' ) #NEWLINE# rows = cursor . fetchall ( ) #NEWLINE# hashes . extend ( [ str ( hash ) for ( hash , offset ) in rows ] ) #NEWLINE# offset -= 1 #NEWLINE# if ( offset > 0 ) : #NEWLINE# #INDENT# for i in xrange ( 1 , int ( math . log ( ( 2 * offset ) , 2 ) ) ) : #NEWLINE# #INDENT# if ( offset <= 1 ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# cursor . execute ( 'select hash from blocks where mainchain = 1 and height = ?' , ( offset , ) ) #NEWLINE# hashes . append ( str ( cursor . fetchone ( ) [ 0 ] ) ) #NEWLINE# offset -= ( 1 << i ) #NEWLINE# #UNINDENT# #UNINDENT# hashes . append ( self . coin . genesis_block_hash ) #NEWLINE# return hashes