#NEWLINE# @ defer . inlineCallbacks #NEWLINE# def _downloadMicroconsensus( self , v2dirs ) : #NEWLINE# #INDENT# random . shuffle ( v2dirs ) #NEWLINE# for dc in v2dirs : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# host = ( ( ( 'http://' + str ( dc . address ) ) + ':' ) + str ( dc . dir_port ) ) #NEWLINE# raw = ( yield getPage ( str ( ( host + MICRO_CONSENSUS_PATH ) ) ) ) #NEWLINE# consensus = _processRawMicroconsensus ( raw ) #NEWLINE# defer . returnValue ( consensus ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# msg = 'Error downloading consensus: {}. Retrying.' . format ( e ) #NEWLINE# logging . debug ( msg ) #NEWLINE# #UNINDENT# #UNINDENT# raise ConsensusDownloadFailed ( 'Failed to download fresh consensus.' )