#NEWLINE# def start_app( config , accounts ) : #NEWLINE# #INDENT# app = HPCApp ( config ) #NEWLINE# if False : #NEWLINE# #INDENT# gevent . get_hub ( ) . SYSTEM_ERROR = BaseException #NEWLINE# #UNINDENT# if config [ 'test_privkeys' ] : #NEWLINE# #INDENT# genesis_config = dict ( alloc = dict ( ) ) #NEWLINE# for privkey in config [ 'test_privkeys' ] : #NEWLINE# #INDENT# assert ( len ( privkey ) == 32 ) #NEWLINE# address = privtoaddr ( privkey ) #NEWLINE# account = Account . new ( password = '' , key = privkey ) #NEWLINE# accounts . append ( account ) #NEWLINE# genesis_config [ 'alloc' ] [ address ] = { #NEWLINE# #INDENT# 'wei' : config [ 'test_privkeys_endowment' ] , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# if ( config [ 'test_privkeys' ] and config [ 'eth' ] . get ( 'genesis_hash' ) ) : #NEWLINE# #INDENT# del config [ 'eth' ] [ 'genesis_hash' ] #NEWLINE# #UNINDENT# konfig . update_config_from_genesis_json ( config , genesis_config ) #NEWLINE# #UNINDENT# pyethapp_app . dump_config ( config ) #NEWLINE# if ( AccountsService in services ) : #NEWLINE# #INDENT# AccountsService . register_with_app ( app ) #NEWLINE# #UNINDENT# for account in accounts : #NEWLINE# #INDENT# app . services . accounts . add_account ( account , store = False ) #NEWLINE# #UNINDENT# if config [ 'hdc' ] [ 'validators' ] : #NEWLINE# #INDENT# assert ( app . services . accounts . coinbase in config [ 'hdc' ] [ 'validators' ] ) #NEWLINE# #UNINDENT# for service in services : #NEWLINE# #INDENT# assert issubclass ( service , BaseService ) #NEWLINE# if ( service . name not in ( app . config [ 'deactivated_services' ] + [ AccountsService . name ] ) ) : #NEWLINE# #INDENT# assert ( service . name not in app . services ) #NEWLINE# service . register_with_app ( app ) #NEWLINE# assert hasattr ( app . services , service . name ) #NEWLINE# #UNINDENT# #UNINDENT# log . info ( 'starting' ) #NEWLINE# app . start ( ) #NEWLINE# for cb in config [ 'post_app_start_callbacks' ] : #NEWLINE# #INDENT# cb ( app ) #NEWLINE# #UNINDENT# return app