#NEWLINE# def ready( self ) : #NEWLINE# #INDENT# self . responding = False #NEWLINE# self . synchronised = False #NEWLINE# self . get_cpu_average ( ) #NEWLINE# try : #NEWLINE# #INDENT# self . _proxy . getinfo ( ) #NEWLINE# self . responding = True #NEWLINE# #UNINDENT# except ( ValueError , socket . error , httplib . CannotSendRequest ) as e : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# except JSONRPCException as e : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# resp = self . _proxy . masternode ( 'debug' ) #NEWLINE# if ( 'Node just started' not in resp ) : #NEWLINE# #INDENT# self . synchronised = True #NEWLINE# #UNINDENT# #UNINDENT# except ( ValueError , socket . error , httplib . CannotSendRequest ) as e : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# except JSONRPCException as e : #NEWLINE# #INDENT# resp = str ( e . error [ 'message' ] ) #NEWLINE# if ( 'masternode' in resp ) : #NEWLINE# #INDENT# if ( self . get_cpu_average ( ) < 50 ) : #NEWLINE# #INDENT# self . synchronised = True #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# logmsg = ( ( self . responding and 'responding, ' ) or 'not responding, ' ) #NEWLINE# logmsg += ( ( self . synchronised and 'synchronised, ' ) or 'not synchronised, ' ) #NEWLINE# logmsg += ( 'cpu: ' + '{0:.2f}' . format ( self . get_cpu_average ( ) ) ) #NEWLINE# info ( logmsg ) #NEWLINE# return ( e . responding and self . synchronised )