Ejemplo n.º 1
0
def get_blockchain_interface_instance(_config):
    source = _config.get("BLOCKCHAIN", "blockchain_source")
    network = _config.get("BLOCKCHAIN", "network")
    testnet = network == 'testnet'
    rpc_host = _config.get("BLOCKCHAIN", "rpc_host")
    rpc_port = _config.get("BLOCKCHAIN", "rpc_port")
    rpc_user = _config.get("BLOCKCHAIN", "rpc_user")
    rpc_password = _config.get("BLOCKCHAIN", "rpc_password")
    rpc = JsonRpc(rpc_host, rpc_port, rpc_user, rpc_password)
    if source == 'bitcoin-rpc':  #pragma: no cover
        #This cannot be tested without mainnet or testnet blockchain (not regtest)
        bc_interface = BitcoinCoreInterface(rpc, network)
    elif source == 'regtest':
        bc_interface = RegtestBitcoinCoreInterface(rpc)
    return bc_interface
Ejemplo n.º 2
0
def test_wrong_network_bci(setup_wallets):
    rpc = jm_single().bc_interface.jsonRpc
    with pytest.raises(Exception) as e_info:
        x = BitcoinCoreInterface(rpc, 'mainnet')