Browse Source

remove legacy clijsonrpc

master
Adam Gibson 9 years ago
parent
commit
3691bfbf06
No known key found for this signature in database
GPG Key ID: B3AE09F1E9A3197A
  1. 37
      jmclient/jmclient/blockchaininterface.py
  2. 6
      jmclient/jmclient/configure.py

37
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

6
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")

Loading…
Cancel
Save