#NEWLINE# def _prove( self , contract ) : #NEWLINE# #INDENT# 'Calculates a proof for the specified contract and puts it into the\n        proof queue\n        ' #NEWLINE# try : #NEWLINE# #INDENT# with self . proving_counter ( ) : #NEWLINE# #INDENT# proven = contract . update_proof ( ) #NEWLINE# #UNINDENT# #UNINDENT# except DownstreamError as ex : #NEWLINE# #INDENT# self . logger . warn ( 'Unable to fulfill contract: {0}' . format ( str ( ex ) ) ) #NEWLINE# self . _remove_contract ( contract ) #NEWLINE# return #NEWLINE# #UNINDENT# if proven : #NEWLINE# #INDENT# submission_time = ( datetime . utcnow ( ) + timedelta ( seconds = self . response_margin ) ) #NEWLINE# if ( contract . expiration > submission_time ) : #NEWLINE# #INDENT# self . submission_queue . put ( contract , submission_time ) #NEWLINE# self . heartbeat_thread . wake ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . logger . info ( 'Proof for contract {0} will not be submitted before expiration.  Dropping contract.' . format ( contract ) ) #NEWLINE# self . _remove_contract ( contract ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . logger . warn ( 'Proof for contract {0} was not available.' . format ( contract ) ) #NEWLINE# self . _remove_contract ( self )