mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-05 18:38:09 +01:00
tests: Fix test_btc_xmr on windows.
This commit is contained in:
@@ -1,15 +1,13 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright (c) 2020-2024 tecnovert
|
# Copyright (c) 2020-2024 tecnovert
|
||||||
|
# Copyright (c) 2025 The Basicswap developers
|
||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
import os
|
|
||||||
import json
|
import json
|
||||||
import shlex
|
|
||||||
import urllib
|
|
||||||
import traceback
|
import traceback
|
||||||
import subprocess
|
import urllib
|
||||||
from xmlrpc.client import (
|
from xmlrpc.client import (
|
||||||
Fault,
|
Fault,
|
||||||
Transport,
|
Transport,
|
||||||
@@ -104,7 +102,7 @@ def callrpc(rpc_port, auth, method, params=[], wallet=None, host="127.0.0.1"):
|
|||||||
r = json.loads(v.decode("utf-8"))
|
r = json.loads(v.decode("utf-8"))
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
raise ValueError("RPC server error " + str(ex) + ", method: " + method)
|
raise ValueError(f"RPC server error: {ex}, method: {method}")
|
||||||
|
|
||||||
if "error" in r and r["error"] is not None:
|
if "error" in r and r["error"] is not None:
|
||||||
raise ValueError("RPC error " + str(r["error"]))
|
raise ValueError("RPC error " + str(r["error"]))
|
||||||
@@ -120,36 +118,7 @@ def openrpc(rpc_port, auth, wallet=None, host="127.0.0.1"):
|
|||||||
return Jsonrpc(url)
|
return Jsonrpc(url)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
raise ValueError("RPC error " + str(ex))
|
raise ValueError(f"RPC error: {ex}")
|
||||||
|
|
||||||
|
|
||||||
def callrpc_cli(bindir, datadir, chain, cmd, cli_bin="particl-cli", wallet=None):
|
|
||||||
cli_bin = os.path.join(bindir, cli_bin)
|
|
||||||
|
|
||||||
args = [
|
|
||||||
cli_bin,
|
|
||||||
]
|
|
||||||
if chain != "mainnet":
|
|
||||||
args.append("-" + chain)
|
|
||||||
args.append("-datadir=" + datadir)
|
|
||||||
if wallet is not None:
|
|
||||||
args.append("-rpcwallet=" + wallet)
|
|
||||||
args += shlex.split(cmd)
|
|
||||||
|
|
||||||
p = subprocess.Popen(
|
|
||||||
args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
|
||||||
)
|
|
||||||
out = p.communicate()
|
|
||||||
|
|
||||||
if len(out[1]) > 0:
|
|
||||||
raise ValueError("RPC error " + str(out[1]))
|
|
||||||
|
|
||||||
r = out[0].decode("utf-8").strip()
|
|
||||||
try:
|
|
||||||
r = json.loads(r)
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
return r
|
|
||||||
|
|
||||||
|
|
||||||
def make_rpc_func(port, auth, wallet=None, host="127.0.0.1"):
|
def make_rpc_func(port, auth, wallet=None, host="127.0.0.1"):
|
||||||
|
|||||||
@@ -6,10 +6,12 @@
|
|||||||
# Distributed under the MIT software license, see the accompanying
|
# Distributed under the MIT software license, see the accompanying
|
||||||
# file LICENSE.txt or http://www.opensource.org/licenses/mit-license.php.
|
# file LICENSE.txt or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
import os
|
|
||||||
import json
|
import json
|
||||||
import signal
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
import shlex
|
||||||
|
import signal
|
||||||
|
import subprocess
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
|
|
||||||
from .util import read_json_api
|
from .util import read_json_api
|
||||||
@@ -133,11 +135,12 @@ def checkForks(ro):
|
|||||||
|
|
||||||
def stopDaemons(daemons):
|
def stopDaemons(daemons):
|
||||||
for d in daemons:
|
for d in daemons:
|
||||||
logging.info("Interrupting %d", d.handle.pid)
|
logging.info(f"Interrupting {d.handle.pid}")
|
||||||
|
signal_type = signal.SIGTERM if os.name == "nt" else signal.SIGINT
|
||||||
try:
|
try:
|
||||||
d.handle.send_signal(signal.SIGINT)
|
d.handle.send_signal(signal_type)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.info("Interrupting %d, error %s", d.handle.pid, str(e))
|
logging.info(f"Interrupting {d.handle.pid}, error: {e}")
|
||||||
for d in daemons:
|
for d in daemons:
|
||||||
try:
|
try:
|
||||||
d.handle.wait(timeout=20)
|
d.handle.wait(timeout=20)
|
||||||
@@ -145,7 +148,7 @@ def stopDaemons(daemons):
|
|||||||
if fp:
|
if fp:
|
||||||
fp.close()
|
fp.close()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.info("Closing %d, error %s", d.handle.pid, str(e))
|
logging.info(f"Closing {d.handle.pid}, error: {e}")
|
||||||
|
|
||||||
|
|
||||||
def wait_for_bid(
|
def wait_for_bid(
|
||||||
@@ -494,3 +497,38 @@ def compare_bid_states_unordered(states, expect_states, ignore_states=[]) -> boo
|
|||||||
logging.info("Have states: {}".format(json.dumps(states, indent=4)))
|
logging.info("Have states: {}".format(json.dumps(states, indent=4)))
|
||||||
raise e
|
raise e
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def callrpc_cli(
|
||||||
|
bindir,
|
||||||
|
datadir,
|
||||||
|
chain,
|
||||||
|
cmd,
|
||||||
|
cli_bin="particl-cli" + (".exe" if os.name == "nt" else ""),
|
||||||
|
wallet=None,
|
||||||
|
):
|
||||||
|
cli_bin = os.path.join(bindir, cli_bin)
|
||||||
|
args = [
|
||||||
|
cli_bin,
|
||||||
|
]
|
||||||
|
if chain != "mainnet":
|
||||||
|
args.append("-" + chain)
|
||||||
|
args.append("-datadir=" + datadir)
|
||||||
|
if wallet is not None:
|
||||||
|
args.append("-rpcwallet=" + wallet)
|
||||||
|
args += shlex.split(cmd)
|
||||||
|
|
||||||
|
p = subprocess.Popen(
|
||||||
|
args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE
|
||||||
|
)
|
||||||
|
out = p.communicate()
|
||||||
|
|
||||||
|
if len(out[1]) > 0:
|
||||||
|
raise ValueError(f"RPC error: {out[1]}")
|
||||||
|
|
||||||
|
r = out[0].decode("utf-8").strip()
|
||||||
|
try:
|
||||||
|
r = json.loads(r)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return r
|
||||||
|
|||||||
@@ -557,12 +557,12 @@ def prepare_nodes(
|
|||||||
):
|
):
|
||||||
bins_path = os.path.join(TEST_PATH, "bin")
|
bins_path = os.path.join(TEST_PATH, "bin")
|
||||||
for i in range(num_nodes):
|
for i in range(num_nodes):
|
||||||
logging.info("Preparing node: %d.", i)
|
logging.info(f"Preparing node: {i}.")
|
||||||
client_path = os.path.join(TEST_PATH, "client{}".format(i))
|
client_path = os.path.join(TEST_PATH, f"client{i}")
|
||||||
try:
|
try:
|
||||||
shutil.rmtree(client_path)
|
shutil.rmtree(client_path)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
logging.warning("setUpClass %s", str(ex))
|
logging.warning(f"setUpClass {ex}")
|
||||||
|
|
||||||
run_prepare(
|
run_prepare(
|
||||||
i,
|
i,
|
||||||
|
|||||||
@@ -40,9 +40,6 @@ from basicswap.basicswap_util import (
|
|||||||
from basicswap.util.address import (
|
from basicswap.util.address import (
|
||||||
toWIF,
|
toWIF,
|
||||||
)
|
)
|
||||||
from basicswap.rpc import (
|
|
||||||
callrpc_cli,
|
|
||||||
)
|
|
||||||
from basicswap.contrib.key import (
|
from basicswap.contrib.key import (
|
||||||
ECKey,
|
ECKey,
|
||||||
)
|
)
|
||||||
@@ -53,6 +50,7 @@ from tests.basicswap.util import (
|
|||||||
read_json_api,
|
read_json_api,
|
||||||
)
|
)
|
||||||
from tests.basicswap.common import (
|
from tests.basicswap.common import (
|
||||||
|
callrpc_cli,
|
||||||
checkForks,
|
checkForks,
|
||||||
stopDaemons,
|
stopDaemons,
|
||||||
wait_for_offer,
|
wait_for_offer,
|
||||||
|
|||||||
@@ -25,13 +25,11 @@ from basicswap.util import (
|
|||||||
make_int,
|
make_int,
|
||||||
format_amount,
|
format_amount,
|
||||||
)
|
)
|
||||||
from basicswap.rpc import (
|
|
||||||
callrpc_cli,
|
|
||||||
)
|
|
||||||
from tests.basicswap.util import (
|
from tests.basicswap.util import (
|
||||||
read_json_api,
|
read_json_api,
|
||||||
)
|
)
|
||||||
from tests.basicswap.common import (
|
from tests.basicswap.common import (
|
||||||
|
callrpc_cli,
|
||||||
stopDaemons,
|
stopDaemons,
|
||||||
wait_for_bid,
|
wait_for_bid,
|
||||||
make_rpc_func,
|
make_rpc_func,
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ from basicswap.util.address import (
|
|||||||
)
|
)
|
||||||
from basicswap.rpc import (
|
from basicswap.rpc import (
|
||||||
callrpc,
|
callrpc,
|
||||||
callrpc_cli,
|
|
||||||
)
|
)
|
||||||
from basicswap.contrib.key import (
|
from basicswap.contrib.key import (
|
||||||
ECKey,
|
ECKey,
|
||||||
@@ -44,19 +43,20 @@ from tests.basicswap.util import (
|
|||||||
read_json_api,
|
read_json_api,
|
||||||
)
|
)
|
||||||
from tests.basicswap.common import (
|
from tests.basicswap.common import (
|
||||||
prepareDataDir,
|
|
||||||
make_rpc_func,
|
|
||||||
checkForks,
|
|
||||||
stopDaemons,
|
|
||||||
delay_for,
|
|
||||||
TEST_HTTP_HOST,
|
|
||||||
TEST_HTTP_PORT,
|
|
||||||
BASE_P2P_PORT,
|
BASE_P2P_PORT,
|
||||||
BASE_RPC_PORT,
|
BASE_RPC_PORT,
|
||||||
BASE_ZMQ_PORT,
|
BASE_ZMQ_PORT,
|
||||||
BTC_BASE_PORT,
|
BTC_BASE_PORT,
|
||||||
BTC_BASE_RPC_PORT,
|
BTC_BASE_RPC_PORT,
|
||||||
|
callrpc_cli,
|
||||||
|
checkForks,
|
||||||
|
delay_for,
|
||||||
|
make_rpc_func,
|
||||||
PREFIX_SECRET_KEY_REGTEST,
|
PREFIX_SECRET_KEY_REGTEST,
|
||||||
|
prepareDataDir,
|
||||||
|
stopDaemons,
|
||||||
|
TEST_HTTP_HOST,
|
||||||
|
TEST_HTTP_PORT,
|
||||||
waitForRPC,
|
waitForRPC,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -40,9 +40,6 @@ from basicswap.basicswap_util import (
|
|||||||
from basicswap.util.address import (
|
from basicswap.util.address import (
|
||||||
toWIF,
|
toWIF,
|
||||||
)
|
)
|
||||||
from basicswap.rpc import (
|
|
||||||
callrpc_cli,
|
|
||||||
)
|
|
||||||
from basicswap.contrib.key import (
|
from basicswap.contrib.key import (
|
||||||
ECKey,
|
ECKey,
|
||||||
)
|
)
|
||||||
@@ -53,6 +50,7 @@ from tests.basicswap.util import (
|
|||||||
read_json_api,
|
read_json_api,
|
||||||
)
|
)
|
||||||
from tests.basicswap.common import (
|
from tests.basicswap.common import (
|
||||||
|
callrpc_cli,
|
||||||
checkForks,
|
checkForks,
|
||||||
stopDaemons,
|
stopDaemons,
|
||||||
wait_for_bid,
|
wait_for_bid,
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ class Test(BaseTest):
|
|||||||
"create_wallet",
|
"create_wallet",
|
||||||
{"filename": "testwallet", "language": "English"},
|
{"filename": "testwallet", "language": "English"},
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
cls.callwownodewallet(cls, i, "open_wallet", {"filename": "testwallet"})
|
cls.callwownodewallet(cls, i, "open_wallet", {"filename": "testwallet"})
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ from basicswap.bin.run import startDaemon
|
|||||||
from basicswap.util.crypto import sha256
|
from basicswap.util.crypto import sha256
|
||||||
from tests.basicswap.test_btc_xmr import BasicSwapTest
|
from tests.basicswap.test_btc_xmr import BasicSwapTest
|
||||||
from tests.basicswap.common import (
|
from tests.basicswap.common import (
|
||||||
|
callrpc_cli,
|
||||||
make_rpc_func,
|
make_rpc_func,
|
||||||
prepareDataDir,
|
prepareDataDir,
|
||||||
stopDaemons,
|
stopDaemons,
|
||||||
@@ -37,9 +38,6 @@ from basicswap.contrib.test_framework.script import (
|
|||||||
OP_CHECKSEQUENCEVERIFY,
|
OP_CHECKSEQUENCEVERIFY,
|
||||||
)
|
)
|
||||||
from basicswap.interface.bch import BCHInterface
|
from basicswap.interface.bch import BCHInterface
|
||||||
from basicswap.rpc import (
|
|
||||||
callrpc_cli,
|
|
||||||
)
|
|
||||||
from basicswap.util import ensure
|
from basicswap.util import ensure
|
||||||
from .test_xmr import test_delay_event, callnoderpc
|
from .test_xmr import test_delay_event, callnoderpc
|
||||||
|
|
||||||
@@ -134,14 +132,20 @@ class TestBCH(BasicSwapTest):
|
|||||||
if not line.startswith("findpeers"):
|
if not line.startswith("findpeers"):
|
||||||
fp.write(line)
|
fp.write(line)
|
||||||
|
|
||||||
if os.path.exists(os.path.join(BITCOINCASH_BINDIR, "bitcoin-wallet")):
|
bch_wallet_bin = "bitcoin-wallet" + (".exe" if os.name == "nt" else "")
|
||||||
|
if os.path.exists(
|
||||||
|
os.path.join(
|
||||||
|
BITCOINCASH_BINDIR,
|
||||||
|
bch_wallet_bin,
|
||||||
|
)
|
||||||
|
):
|
||||||
try:
|
try:
|
||||||
callrpc_cli(
|
callrpc_cli(
|
||||||
BITCOINCASH_BINDIR,
|
BITCOINCASH_BINDIR,
|
||||||
data_dir,
|
data_dir,
|
||||||
"regtest",
|
"regtest",
|
||||||
"-wallet=wallet.dat create",
|
"-wallet=wallet.dat create",
|
||||||
"bitcoin-wallet",
|
bch_wallet_bin,
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.warning("bch: bitcoin-wallet create failed")
|
logging.warning("bch: bitcoin-wallet create failed")
|
||||||
|
|||||||
@@ -24,9 +24,6 @@ import threading
|
|||||||
import multiprocessing
|
import multiprocessing
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from basicswap.rpc import (
|
|
||||||
callrpc_cli,
|
|
||||||
)
|
|
||||||
from tests.basicswap.util import (
|
from tests.basicswap.util import (
|
||||||
read_json_api,
|
read_json_api,
|
||||||
post_json_api,
|
post_json_api,
|
||||||
@@ -38,6 +35,7 @@ from tests.basicswap.common import (
|
|||||||
waitForNumSwapping,
|
waitForNumSwapping,
|
||||||
)
|
)
|
||||||
from tests.basicswap.common_xmr import (
|
from tests.basicswap.common_xmr import (
|
||||||
|
callrpc_cli,
|
||||||
prepare_nodes,
|
prepare_nodes,
|
||||||
)
|
)
|
||||||
import basicswap.bin.run as runSystem
|
import basicswap.bin.run as runSystem
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ from basicswap.util.address import (
|
|||||||
)
|
)
|
||||||
from basicswap.rpc import (
|
from basicswap.rpc import (
|
||||||
callrpc,
|
callrpc,
|
||||||
callrpc_cli,
|
|
||||||
)
|
)
|
||||||
from basicswap.rpc_xmr import (
|
from basicswap.rpc_xmr import (
|
||||||
callrpc_xmr,
|
callrpc_xmr,
|
||||||
@@ -61,6 +60,7 @@ from tests.basicswap.util import (
|
|||||||
read_json_api,
|
read_json_api,
|
||||||
)
|
)
|
||||||
from tests.basicswap.common import (
|
from tests.basicswap.common import (
|
||||||
|
callrpc_cli,
|
||||||
prepareDataDir,
|
prepareDataDir,
|
||||||
make_rpc_func,
|
make_rpc_func,
|
||||||
checkForks,
|
checkForks,
|
||||||
@@ -376,7 +376,7 @@ class BaseTest(unittest.TestCase):
|
|||||||
|
|
||||||
if os.path.isdir(TEST_DIR):
|
if os.path.isdir(TEST_DIR):
|
||||||
if RESET_TEST:
|
if RESET_TEST:
|
||||||
logging.info("Removing " + TEST_DIR)
|
logging.info("Removing test dir " + TEST_DIR)
|
||||||
for name in os.listdir(TEST_DIR):
|
for name in os.listdir(TEST_DIR):
|
||||||
if name == "pivx-params":
|
if name == "pivx-params":
|
||||||
continue
|
continue
|
||||||
@@ -388,6 +388,8 @@ class BaseTest(unittest.TestCase):
|
|||||||
else:
|
else:
|
||||||
logging.info("Restoring instance from " + TEST_DIR)
|
logging.info("Restoring instance from " + TEST_DIR)
|
||||||
cls.restore_instance = True
|
cls.restore_instance = True
|
||||||
|
else:
|
||||||
|
logging.info("Creating test dir " + TEST_DIR)
|
||||||
if not os.path.exists(TEST_DIR):
|
if not os.path.exists(TEST_DIR):
|
||||||
os.makedirs(TEST_DIR)
|
os.makedirs(TEST_DIR)
|
||||||
|
|
||||||
@@ -399,19 +401,25 @@ class BaseTest(unittest.TestCase):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
logging.info("Preparing coin nodes.")
|
logging.info("Preparing coin nodes.")
|
||||||
|
part_wallet_bin = "particl-wallet" + (".exe" if os.name == "nt" else "")
|
||||||
for i in range(NUM_NODES):
|
for i in range(NUM_NODES):
|
||||||
if not cls.restore_instance:
|
if not cls.restore_instance:
|
||||||
data_dir = prepareDataDir(TEST_DIR, i, "particl.conf", "part_")
|
data_dir = prepareDataDir(TEST_DIR, i, "particl.conf", "part_")
|
||||||
if os.path.exists(
|
if not os.path.exists(
|
||||||
os.path.join(cfg.PARTICL_BINDIR, "particl-wallet")
|
os.path.join(
|
||||||
|
cfg.PARTICL_BINDIR,
|
||||||
|
part_wallet_bin,
|
||||||
|
)
|
||||||
):
|
):
|
||||||
|
logging.warning(f"{part_wallet_bin} not found.")
|
||||||
|
else:
|
||||||
try:
|
try:
|
||||||
callrpc_cli(
|
callrpc_cli(
|
||||||
cfg.PARTICL_BINDIR,
|
cfg.PARTICL_BINDIR,
|
||||||
data_dir,
|
data_dir,
|
||||||
"regtest",
|
"regtest",
|
||||||
"-wallet=wallet.dat -legacy create",
|
"-wallet=wallet.dat -legacy create",
|
||||||
"particl-wallet",
|
part_wallet_bin,
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.warning(
|
logging.warning(
|
||||||
@@ -422,7 +430,7 @@ class BaseTest(unittest.TestCase):
|
|||||||
data_dir,
|
data_dir,
|
||||||
"regtest",
|
"regtest",
|
||||||
"-wallet=wallet.dat create",
|
"-wallet=wallet.dat create",
|
||||||
"particl-wallet",
|
part_wallet_bin,
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.part_daemons.append(
|
cls.part_daemons.append(
|
||||||
@@ -471,6 +479,7 @@ class BaseTest(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
rpc("reservebalance", [False])
|
rpc("reservebalance", [False])
|
||||||
|
|
||||||
|
btc_wallet_bin = "bitcoin-wallet" + (".exe" if os.name == "nt" else "")
|
||||||
for i in range(NUM_BTC_NODES):
|
for i in range(NUM_BTC_NODES):
|
||||||
if not cls.restore_instance:
|
if not cls.restore_instance:
|
||||||
data_dir = prepareDataDir(
|
data_dir = prepareDataDir(
|
||||||
@@ -481,9 +490,14 @@ class BaseTest(unittest.TestCase):
|
|||||||
base_p2p_port=BTC_BASE_PORT,
|
base_p2p_port=BTC_BASE_PORT,
|
||||||
base_rpc_port=BTC_BASE_RPC_PORT,
|
base_rpc_port=BTC_BASE_RPC_PORT,
|
||||||
)
|
)
|
||||||
if os.path.exists(
|
if not os.path.exists(
|
||||||
os.path.join(cfg.BITCOIN_BINDIR, "bitcoin-wallet")
|
os.path.join(
|
||||||
|
cfg.BITCOIN_BINDIR,
|
||||||
|
btc_wallet_bin,
|
||||||
|
)
|
||||||
):
|
):
|
||||||
|
logging.warning(f"{btc_wallet_bin} not found.")
|
||||||
|
else:
|
||||||
if BTC_USE_DESCRIPTORS:
|
if BTC_USE_DESCRIPTORS:
|
||||||
# How to set blank and disable_private_keys with wallet util?
|
# How to set blank and disable_private_keys with wallet util?
|
||||||
pass
|
pass
|
||||||
@@ -494,7 +508,7 @@ class BaseTest(unittest.TestCase):
|
|||||||
data_dir,
|
data_dir,
|
||||||
"regtest",
|
"regtest",
|
||||||
"-wallet=wallet.dat -legacy create",
|
"-wallet=wallet.dat -legacy create",
|
||||||
"bitcoin-wallet",
|
btc_wallet_bin,
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.warning(
|
logging.warning(
|
||||||
@@ -505,7 +519,7 @@ class BaseTest(unittest.TestCase):
|
|||||||
data_dir,
|
data_dir,
|
||||||
"regtest",
|
"regtest",
|
||||||
"-wallet=wallet.dat create",
|
"-wallet=wallet.dat create",
|
||||||
"bitcoin-wallet",
|
btc_wallet_bin,
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.btc_daemons.append(
|
cls.btc_daemons.append(
|
||||||
@@ -536,6 +550,7 @@ class BaseTest(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if cls.start_ltc_nodes:
|
if cls.start_ltc_nodes:
|
||||||
|
ltc_wallet_bin = "litecoin-wallet" + (".exe" if os.name == "nt" else "")
|
||||||
for i in range(NUM_LTC_NODES):
|
for i in range(NUM_LTC_NODES):
|
||||||
if not cls.restore_instance:
|
if not cls.restore_instance:
|
||||||
data_dir = prepareDataDir(
|
data_dir = prepareDataDir(
|
||||||
@@ -547,14 +562,16 @@ class BaseTest(unittest.TestCase):
|
|||||||
base_rpc_port=LTC_BASE_RPC_PORT,
|
base_rpc_port=LTC_BASE_RPC_PORT,
|
||||||
)
|
)
|
||||||
if os.path.exists(
|
if os.path.exists(
|
||||||
os.path.join(cfg.LITECOIN_BINDIR, "litecoin-wallet")
|
os.path.join(cfg.LITECOIN_BINDIR, ltc_wallet_bin)
|
||||||
):
|
):
|
||||||
|
logging.warning(f"{ltc_wallet_bin} not found.")
|
||||||
|
else:
|
||||||
callrpc_cli(
|
callrpc_cli(
|
||||||
cfg.LITECOIN_BINDIR,
|
cfg.LITECOIN_BINDIR,
|
||||||
data_dir,
|
data_dir,
|
||||||
"regtest",
|
"regtest",
|
||||||
"-wallet=wallet.dat create",
|
"-wallet=wallet.dat create",
|
||||||
"litecoin-wallet",
|
ltc_wallet_bin,
|
||||||
)
|
)
|
||||||
|
|
||||||
cls.ltc_daemons.append(
|
cls.ltc_daemons.append(
|
||||||
@@ -620,6 +637,7 @@ class BaseTest(unittest.TestCase):
|
|||||||
"create_wallet",
|
"create_wallet",
|
||||||
{"filename": "testwallet", "language": "English"},
|
{"filename": "testwallet", "language": "English"},
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
cls.callxmrnodewallet(
|
cls.callxmrnodewallet(
|
||||||
cls, i, "open_wallet", {"filename": "testwallet"}
|
cls, i, "open_wallet", {"filename": "testwallet"}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user