api: Add wallet lock/unlock commands and getcoinseed.
This commit is contained in:
21 files changed
+412
-121
No files matched your search
@@ -14,6 +14,7 @@ import os
|
||||
import sys
|
||||
import json
|
||||
import time
|
||||
import random
|
||||
import shutil
|
||||
import signal
|
||||
import logging
|
||||
@@ -204,8 +205,8 @@ def btcRpc(cmd):
|
||||
return callrpc_cli(cfg.BITCOIN_BINDIR, os.path.join(cfg.TEST_DATADIRS, str(BTC_NODE)), 'regtest', cmd, cfg.BITCOIN_CLI)
|
||||
|
||||
|
||||
def dashRpc(cmd):
|
||||
return callrpc_cli(cfg.DASH_BINDIR, os.path.join(cfg.TEST_DATADIRS, str(DASH_NODE)), 'regtest', cmd, cfg.DASH_CLI)
|
||||
def dashRpc(cmd, wallet=None):
|
||||
return callrpc_cli(cfg.DASH_BINDIR, os.path.join(cfg.TEST_DATADIRS, str(DASH_NODE)), 'regtest', cmd, cfg.DASH_CLI, wallet=wallet)
|
||||
|
||||
|
||||
def signal_handler(sig, frame):
|
||||
@@ -533,18 +534,17 @@ class Test(unittest.TestCase):
|
||||
self.swap_clients[0].initialiseWallet(Coins.DASH, raise_errors=True)
|
||||
assert self.swap_clients[0].checkWalletSeed(Coins.DASH) is True
|
||||
|
||||
pivx_addr = dashRpc('getnewaddress \"hd test\"')
|
||||
assert pivx_addr == 'ybzWYJbZEhZai8kiKkTtPFKTuDNwhpiwac'
|
||||
addr = dashRpc('getnewaddress \"hd wallet test\"')
|
||||
assert addr == 'ybzWYJbZEhZai8kiKkTtPFKTuDNwhpiwac'
|
||||
|
||||
def pass_99_delay(self):
|
||||
global stop_test
|
||||
logging.info('Delay')
|
||||
for i in range(60 * 5):
|
||||
if stop_test:
|
||||
break
|
||||
time.sleep(1)
|
||||
print('delay', i)
|
||||
stop_test = True
|
||||
logging.info('Test that getcoinseed returns a mnemonic for Dash')
|
||||
mnemonic = read_json_api(1800, 'getcoinseed', {'coin': 'DASH'})['mnemonic']
|
||||
new_wallet_name = random.randbytes(10).hex()
|
||||
dashRpc(f'createwallet \"{new_wallet_name}\"')
|
||||
dashRpc(f'upgradetohd \"{mnemonic}\"', wallet=new_wallet_name)
|
||||
addr_test = dashRpc('getnewaddress', wallet=new_wallet_name)
|
||||
dashRpc('unloadwallet', wallet=new_wallet_name)
|
||||
assert (addr_test == addr)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -108,6 +108,8 @@ class Test(BaseTest):
|
||||
firo_daemons = []
|
||||
firo_addr = None
|
||||
test_coin_from = Coins.FIRO
|
||||
start_ltc_nodes = False
|
||||
start_xmr_nodes = False
|
||||
|
||||
test_atomic = True
|
||||
test_xmr = False
|
||||
@@ -119,12 +121,6 @@ class Test(BaseTest):
|
||||
'c5de2be44834e7e47ad7dc8e35c6b77c79f17c6bb40d5509a00fc3dff384a865',
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.start_ltc_nodes = False
|
||||
cls.start_xmr_nodes = False
|
||||
super(Test, cls).setUpClass()
|
||||
|
||||
@classmethod
|
||||
def prepareExtraDataDir(cls, i):
|
||||
if not cls.restore_instance:
|
||||
@@ -135,7 +131,7 @@ class Test(BaseTest):
|
||||
callrpc_cli(cfg.FIRO_BINDIR, data_dir, 'regtest', '-wallet=wallet.dat create', 'firo-wallet')
|
||||
|
||||
cls.firo_daemons.append(startDaemon(os.path.join(cfg.TEST_DATADIRS, 'firo_' + str(i)), cfg.FIRO_BINDIR, cfg.FIROD, opts=extra_opts))
|
||||
logging.info('Started %s %d', cfg.FIROD, cls.part_daemons[-1].pid)
|
||||
logging.info('Started %s %d', cfg.FIROD, cls.firo_daemons[-1].pid)
|
||||
|
||||
waitForRPC(make_rpc_func(i, base_rpc_port=FIRO_BASE_RPC_PORT))
|
||||
|
||||
|
||||
@@ -349,7 +349,7 @@ class Test(unittest.TestCase):
|
||||
num_blocks = 3
|
||||
logging.info('Waiting for Particl chain height %d', num_blocks)
|
||||
for i in range(60):
|
||||
particl_blocks = cls.swap_clients[0].callrpc('getblockchaininfo')['blocks']
|
||||
particl_blocks = cls.swap_clients[0].callrpc('getblockcount')
|
||||
print('particl_blocks', particl_blocks)
|
||||
if particl_blocks >= num_blocks:
|
||||
break
|
||||
|
||||
@@ -360,7 +360,7 @@ class Test(unittest.TestCase):
|
||||
num_blocks = 3
|
||||
logging.info('Waiting for Particl chain height %d', num_blocks)
|
||||
for i in range(60):
|
||||
particl_blocks = cls.swap_clients[0].callrpc('getblockchaininfo')['blocks']
|
||||
particl_blocks = cls.swap_clients[0].callrpc('getblockcount')
|
||||
print('particl_blocks', particl_blocks)
|
||||
if particl_blocks >= num_blocks:
|
||||
break
|
||||
@@ -563,16 +563,6 @@ class Test(unittest.TestCase):
|
||||
break
|
||||
assert found
|
||||
|
||||
def pass_99_delay(self):
|
||||
global stop_test
|
||||
logging.info('Delay')
|
||||
for i in range(60 * 5):
|
||||
if stop_test:
|
||||
break
|
||||
time.sleep(1)
|
||||
print('delay', i)
|
||||
stop_test = True
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -176,7 +176,7 @@ class Test(unittest.TestCase):
|
||||
for i in range(60):
|
||||
if self.delay_event.is_set():
|
||||
raise ValueError('Test stopped.')
|
||||
particl_blocks = callpartrpc(0, 'getblockchaininfo')['blocks']
|
||||
particl_blocks = callpartrpc(0, 'getblockcount')
|
||||
print('particl_blocks', particl_blocks)
|
||||
if particl_blocks >= num_blocks:
|
||||
break
|
||||
|
||||
Reference in new issue
Block a user