From 3691bfbf06dbdbca0738feca7ba763373b6751de Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Wed, 30 Nov 2016 21:29:37 +0200 Subject: [PATCH] remove legacy clijsonrpc --- jmclient/jmclient/blockchaininterface.py | 37 ------------------------ jmclient/jmclient/configure.py | 6 ---- 2 files changed, 43 deletions(-) diff --git a/jmclient/jmclient/blockchaininterface.py b/jmclient/jmclient/blockchaininterface.py index 8692fee..1efc4bb 100644 --- a/jmclient/jmclient/blockchaininterface.py +++ b/jmclient/jmclient/blockchaininterface.py @@ -18,49 +18,12 @@ from decimal import Decimal import btc -# This can be removed once CliJsonRpc is gone. -import subprocess - from jmclient.jsonrpc import JsonRpcConnectionError, JsonRpcError from jmclient.configure import get_p2pk_vbyte, jm_single from jmbase.support import get_log, chunks log = get_log() - -class CliJsonRpc(object): - """ - Fake JsonRpc class that uses the Bitcoin CLI executable. This is used - as temporary fall back before we switch completely (and exclusively) - to the real JSON-RPC interface. - """ - - def __init__(self, cli, testnet): - self.cli = cli - if testnet: - self.cli.append("-testnet") - - def call(self, method, params): - fullCall = [] - fullCall.extend(self.cli) - fullCall.append(method) - for p in params: - if isinstance(p, basestring): - fullCall.append(p) - else: - fullCall.append(json.dumps(p)) - - res = subprocess.check_output(fullCall) - - if res == '': - return None - - try: - return json.loads(res) - except ValueError: - return res.strip() - - def is_index_ahead_of_cache(wallet, mix_depth, forchange): if mix_depth >= len(wallet.index_cache): return True diff --git a/jmclient/jmclient/configure.py b/jmclient/jmclient/configure.py index e7edea1..76c996f 100644 --- a/jmclient/jmclient/configure.py +++ b/jmclient/jmclient/configure.py @@ -343,7 +343,6 @@ def get_blockchain_interface_instance(_config): # importing here is necessary to avoid import loops from jmclient.blockchaininterface import BitcoinCoreInterface, \ RegtestBitcoinCoreInterface, BlockrInterface, ElectrumWalletInterface - from jmclient.blockchaininterface import CliJsonRpc source = _config.get("BLOCKCHAIN", "blockchain_source") network = get_network() @@ -355,11 +354,6 @@ def get_blockchain_interface_instance(_config): rpc_password = _config.get("BLOCKCHAIN", "rpc_password") rpc = JsonRpc(rpc_host, rpc_port, rpc_user, rpc_password) bc_interface = BitcoinCoreInterface(rpc, network) - elif source == 'json-rpc': - bitcoin_cli_cmd = _config.get("BLOCKCHAIN", - "bitcoin_cli_cmd").split(' ') - rpc = CliJsonRpc(bitcoin_cli_cmd, testnet) - bc_interface = BitcoinCoreInterface(rpc, network) elif source == 'regtest': rpc_host = _config.get("BLOCKCHAIN", "rpc_host") rpc_port = _config.get("BLOCKCHAIN", "rpc_port")