def test_dashd(): config_text = DashConfig.slurp_config_file(config.dash_conf) creds = DashConfig.get_rpc_creds(config_text, 'testnet') dashd = DashDaemon( user = creds.get('user'), password = creds.get('password'), port = creds.get('port') ) assert dashd.rpc_command != None assert hasattr(dashd, 'rpc_connection') == True # Dash testnet block 0 hash == 00000bafbc94add76cb75e2ec92894837288a481e5c005f6563d91623bf8bc2c # test commands without arguments info = dashd.rpc_command('getinfo') info_keys = [ 'blocks', 'connections', 'difficulty', 'errors', 'protocolversion', 'proxy', 'testnet', 'timeoffset', 'version', ] for key in info_keys: assert key in info assert info['testnet'] == True # test commands with args assert dashd.rpc_command('getblockhash', 0) == u'00000bafbc94add76cb75e2ec92894837288a481e5c005f6563d91623bf8bc2c'
def from_dash_conf(self, dash_dot_conf): from dash_config import DashConfig config_text = DashConfig.slurp_config_file(dash_dot_conf) creds = DashConfig.get_rpc_creds(config_text, config.network) creds[u'host'] = config.rpc_host return self(**creds)
def from_dash_conf(self, dash_dot_conf): from dash_config import DashConfig config_text = DashConfig.slurp_config_file(dash_dot_conf) creds = DashConfig.get_rpc_creds(config_text, config.network) return self(user=creds.get('user'), password=creds.get('password'), port=creds.get('port'))
def test_slurp_config_file(): import tempfile dash_config = """# basic settings #testnet=1 # TESTNET server=1 printtoconsole=1 txindex=1 # enable transaction index """ expected_stripped_config = """server=1 printtoconsole=1 txindex=1 # enable transaction index """ with tempfile.NamedTemporaryFile(mode='w') as temp: temp.write(dash_config) temp.flush() conf = DashConfig.slurp_config_file(temp.name) assert conf == expected_stripped_config
def main(): # Get dash.conf location and load key values config_text = DashConfig.slurp_config_file(config.dash_conf) # Get valid addresses and determine networks used (Main and/or Test) addresses = load_address_file(config.address_file) networks = get_used_networks(addresses) print('Addresses found on {} network(s)'.format(networks)) # Establish connections to used network(s) rpc_connections = {} for network in networks: rpc_params = DashConfig.get_rpc_creds(config_text, network) rpc_connections[network] = RPCHost(rpc_params['user'], rpc_params['password'], rpc_params['port']) print(rpc_connections) poll_addresses(rpc_connections, addresses)
def test_dashd(): config_text = DashConfig.slurp_config_file(config.dash_conf) network = 'mainnet' is_testnet = False genesis_hash = u'00000ffd590b1485b3caadc19b22e6379c733355108f107a430458cdf3407ab6' for line in config_text.split("\n"): if line.startswith('testnet=1'): network = 'testnet' is_testnet = True genesis_hash = u'00000bafbc94add76cb75e2ec92894837288a481e5c005f6563d91623bf8bc2c' creds = DashConfig.get_rpc_creds(config_text, network) dashd = DashDaemon(**creds) assert dashd.rpc_command is not None assert hasattr(dashd, 'rpc_connection') # Dash testnet block 0 hash == 00000bafbc94add76cb75e2ec92894837288a481e5c005f6563d91623bf8bc2c # test commands without arguments info = dashd.rpc_command('getinfo') info_keys = [ 'blocks', 'connections', 'difficulty', 'errors', 'protocolversion', 'proxy', 'testnet', 'timeoffset', 'version', ] for key in info_keys: assert key in info assert info['testnet'] is is_testnet # test commands with args assert dashd.rpc_command('getblockhash', 0) == genesis_hash
def test_dashd(): config_text = DashConfig.slurp_config_file(config.dash_conf) network = 'mainnet' is_testnet = False genesis_hash = u'000001f47616c621df9a832559b9e562176656bc5d7e753018983ad8c0b2d284' for line in config_text.split("\n"): if line.startswith('testnet=1'): network = 'testnet' is_testnet = True genesis_hash = u'0000095981c16c629ffafa06d096d686486a7698d9ba14db7dfa72fd4a6a36de' creds = DashConfig.get_rpc_creds(config_text, network) dashd = DashDaemon(**creds) assert dashd.rpc_command is not None assert hasattr(dashd, 'rpc_connection') # Dash testnet block 0 hash == 00000bafbc94add76cb75e2ec92894837288a481e5c005f6563d91623bf8bc2c # test commands without arguments info = dashd.rpc_command('getinfo') info_keys = [ 'blocks', 'connections', 'difficulty', 'errors', 'protocolversion', 'proxy', 'testnet', 'timeoffset', 'version', ] for key in info_keys: assert key in info assert info['testnet'] is is_testnet # test commands with args assert dashd.rpc_command('getblockhash', 0) == genesis_hash
def test_dashd(): config_text = DashConfig.slurp_config_file(config.dash_conf) network = 'mainnet' is_testnet = False genesis_hash = u'00000ee6635b617e6b850ba638411c956bc5e0b977c2aa466a2116b4b767599c' for line in config_text.split("\n"): if line.startswith('testnet=1'): network = 'testnet' is_testnet = True genesis_hash = u'000004d72c95dada076575d05dddfb8be794c5ff8e6fa983e18b509995a03740' creds = DashConfig.get_rpc_creds(config_text, network) dashd = DashDaemon(**creds) assert dashd.rpc_command is not None assert hasattr(dashd, 'rpc_connection') # LUSO testnet block 0 hash == 000004d72c95dada076575d05dddfb8be794c5ff8e6fa983e18b509995a03740 # test commands without arguments info = dashd.rpc_command('getinfo') info_keys = [ 'blocks', 'connections', 'difficulty', 'errors', 'protocolversion', 'proxy', 'testnet', 'timeoffset', 'version', ] for key in info_keys: assert key in info assert info['testnet'] is is_testnet # test commands with args assert dashd.rpc_command('getblockhash', 0) == genesis_hash
def test_dashd(): config_text = DashConfig.slurp_config_file(config.dash_conf) network = 'mainnet' is_testnet = False genesis_hash = u'00000c63f5826a523923939a5adf28657c2a6b76764f1af99bb39437006489d3' for line in config_text.split("\n"): if line.startswith('testnet=1'): network = 'testnet' is_testnet = True genesis_hash = u'00000341adf1dd4375bef8ff8059b4268fe0282d8a66f8cf5419bd6b13fbb77b' creds = DashConfig.get_rpc_creds(config_text, network) dashd = DashDaemon(**creds) assert dashd.rpc_command is not None assert hasattr(dashd, 'rpc_connection') # Dash testnet block 0 hash == 00000bafbc94add76cb75e2ec92894837288a481e5c005f6563d91623bf8bc2c # test commands without arguments info = dashd.rpc_command('getinfo') info_keys = [ 'blocks', 'connections', 'difficulty', 'errors', 'protocolversion', 'proxy', 'testnet', 'timeoffset', 'version', ] for key in info_keys: assert key in info assert info['testnet'] is is_testnet # test commands with args assert dashd.rpc_command('getblockhash', 0) == genesis_hash