Update Bitcoin and Particl cores to 0.21

wallet.dat is no longer loaded by default.
2024-05-20_merge
tecnovert 4 years ago
parent 64caceebfe
commit f934b2d8f2
No known key found for this signature in database
GPG Key ID: 8ED6D8750C4E3F93
  1. 2
      basicswap/__init__.py
  2. 19
      bin/basicswap_prepare.py
  3. 5
      doc/upgrade.md
  4. 3
      tests/basicswap/common.py
  5. 4
      tests/basicswap/extended/test_network.py
  6. 4
      tests/basicswap/extended/test_wallet_init.py
  7. 14
      tests/basicswap/extended/test_xmr_persistent.py
  8. 4
      tests/basicswap/test_reload.py
  9. 11
      tests/basicswap/test_run.py
  10. 8
      tests/basicswap/test_xmr.py
  11. 2
      tests/basicswap/test_xmr_bids_offline.py
  12. 2
      tests/basicswap/test_xmr_reload.py

@ -1,3 +1,3 @@
name = "basicswap"
__version__ = "0.0.10"
__version__ = "0.0.11"

@ -41,9 +41,9 @@ else:
FILE_EXT = 'tar.gz'
known_coins = {
'particl': '0.19.1.2',
'particl': '0.21.0.1',
'litecoin': '0.18.1',
'bitcoin': '0.20.1',
'bitcoin': '0.21.0',
'namecoin': '0.18.0',
'monero': '0.17.1.9',
}
@ -140,7 +140,7 @@ def extractCore(coin, version, settings, bin_dir, release_path):
bins = [coin + 'd', coin + '-cli', coin + '-tx']
versions = version.split('.')
if coin == 'particl' and int(versions[1]) >= 19:
if int(versions[1]) >= 19:
bins.append(coin + '-wallet')
if 'win32' in BIN_ARCH or 'win64' in BIN_ARCH:
with zipfile.ZipFile(release_path) as fz:
@ -299,6 +299,7 @@ def prepareCore(coin, version, settings, data_dir):
def prepareDataDir(coin, settings, chain, particl_mnemonic):
core_settings = settings['chainclients'][coin]
bin_dir = core_settings['bindir']
data_dir = core_settings['datadir']
if not os.path.exists(data_dir):
@ -353,6 +354,7 @@ def prepareDataDir(coin, settings, chain, particl_mnemonic):
fp.write('rpcport={}\n'.format(core_settings['rpcport']))
fp.write('printtoconsole=0\n')
fp.write('daemon=0\n')
fp.write('wallet=wallet.dat\n')
if coin == 'particl':
fp.write('debugexclude=libevent\n')
@ -364,15 +366,20 @@ def prepareDataDir(coin, settings, chain, particl_mnemonic):
if particl_mnemonic == 'none':
fp.write('createdefaultmasterkey=1')
elif coin == 'litecoin':
fp.write('prune=1000\n')
fp.write('prune=2000\n')
elif coin == 'bitcoin':
fp.write('prune=1000\n')
fp.write('prune=2000\n')
fp.write('fallbackfee=0.0002\n')
elif coin == 'namecoin':
fp.write('prune=1000\n')
fp.write('prune=2000\n')
else:
logger.warning('Unknown coin %s', coin)
wallet_util = coin + '-wallet'
if os.path.exists(os.path.join(bin_dir, wallet_util)):
logger.info('Creating wallet.dat for {}.'.format(wallet_util.capitalize()))
callrpc_cli(bin_dir, data_dir, chain, '-wallet=wallet.dat create', wallet_util)
def printVersion():
from basicswap import __version__

@ -22,7 +22,7 @@ If the dependencies and db format have changed the container must be built with
#### Update core versions
After updating the code and rebuilding the container:
After updating the code and rebuilding the container run:
basicswap/docker]$ docker run \
-t --name swap_prepare -v $COINDATA_PATH:/coindata i_swapclient \
@ -30,6 +30,9 @@ After updating the code and rebuilding the container:
docker rm swap_prepare
Specify all required coins after `--withcoins=`, separated by commas.
If updating from versions below 0.21, you may need to add `wallet=wallet.dat` to the core config files.
## If installed through pip:

@ -59,6 +59,7 @@ def prepareDataDir(datadir, node_id, conf_file, dir_prefix, base_p2p_port=BASE_P
fp.write('fallbackfee=0.01\n')
fp.write('acceptnonstdtxn=0\n')
fp.write('txindex=1\n')
fp.write('wallet=wallet.dat\n')
fp.write('findpeers=0\n')
# minstakeinterval=5 # Using walletsettings stakelimit instead
@ -72,6 +73,8 @@ def prepareDataDir(datadir, node_id, conf_file, dir_prefix, base_p2p_port=BASE_P
continue
fp.write('addnode=127.0.0.1:{}\n'.format(base_p2p_port + i))
return node_dir
def checkForks(ro):
if 'bip9_softforks' in ro:

@ -195,7 +195,9 @@ class Test(unittest.TestCase):
try:
logging.info('Preparing coin nodes.')
for i in range(NUM_NODES):
prepareDataDir(TEST_DIR, i, 'particl.conf', 'part_')
data_dir = prepareDataDir(TEST_DIR, i, 'particl.conf', 'part_')
if os.path.exists(os.path.join(cfg.PARTICL_BINDIR, 'particl-wallet')):
callrpc_cli(cfg.PARTICL_BINDIR, data_dir, 'regtest', '-wallet=wallet.dat create', 'particl-wallet')
cls.part_daemons.append(startDaemon(os.path.join(TEST_DIR, 'part_' + str(i)), cfg.PARTICL_BINDIR, cfg.PARTICLD))
logging.info('Started %s %d', cfg.PARTICLD, cls.part_daemons[-1].pid)

@ -8,9 +8,9 @@
"""
export TEST_PATH=/tmp/test_basicswap_wallet_init
mkdir -p ${TEST_PATH}/bin/{particl,monero,bitcoin}
cp ~/tmp/particl-0.19.1.2-x86_64-linux-gnu.tar.gz ${TEST_PATH}/bin/particl
cp ~/tmp/particl-0.21.0.1-x86_64-linux-gnu.tar.gz ${TEST_PATH}/bin/particl
cp ~/tmp/monero-linux-x64-v0.17.1.9.tar.bz2 ${TEST_PATH}/bin/monero/monero-0.17.1.9-x86_64-linux-gnu.tar.bz2
cp ~/tmp/bitcoin-0.20.1-x86_64-linux-gnu.tar.gz ${TEST_PATH}/bin/bitcoin
cp ~/tmp/bitcoin-0.21.0-x86_64-linux-gnu.tar.gz ${TEST_PATH}/bin/bitcoin
export PYTHONPATH=$(pwd)
python tests/basicswap/extended/test_wallet_init.py

@ -9,8 +9,8 @@
export RESET_TEST=true
export TEST_PATH=/tmp/test_persistent
mkdir -p ${TEST_PATH}/bin/{particl,monero,bitcoin}
cp ~/tmp/particl-0.19.1.2-x86_64-linux-gnu.tar.gz ${TEST_PATH}/bin/particl
cp ~/tmp/bitcoin-0.20.1-x86_64-linux-gnu.tar.gz ${TEST_PATH}/bin/bitcoin
cp ~/tmp/particl-0.21.0.1-x86_64-linux-gnu.tar.gz ${TEST_PATH}/bin/particl
cp ~/tmp/bitcoin-0.21.0-x86_64-linux-gnu.tar.gz ${TEST_PATH}/bin/bitcoin
cp ~/tmp/monero-linux-x64-v0.17.1.9.tar.bz2 ${TEST_PATH}/bin/monero/monero-0.17.1.9-x86_64-linux-gnu.tar.bz2
export PYTHONPATH=$(pwd)
python tests/basicswap/extended/test_xmr_persistent.py
@ -78,6 +78,7 @@ def callpartrpc(node_id, method, params=[], wallet=None, base_rpc_port=BASE_PART
auth = 'test_part_{0}:test_part_pwd_{0}'.format(node_id)
return callrpc(base_rpc_port + node_id, auth, method, params, wallet)
def callbtcrpc(node_id, method, params=[], wallet=None, base_rpc_port=BASE_BTC_RPC_PORT + PORT_OFS):
auth = 'test_btc_{0}:test_btc_pwd_{0}'.format(node_id)
return callrpc(base_rpc_port + node_id, auth, method, params, wallet)
@ -230,19 +231,12 @@ class Test(unittest.TestCase):
xmr_addr1 = wallets['6']['deposit_address']
num_blocks = 100
if callrpc_xmr_na(XMR_BASE_RPC_PORT + 1, 'get_block_count')['count'] < num_blocks:
logging.info('Mining {} Monero blocks to {}.'.format(num_blocks, xmr_addr1))
callrpc_xmr_na(XMR_BASE_RPC_PORT + 1, 'generateblocks', {'wallet_address': xmr_addr1, 'amount_of_blocks': num_blocks})
logging.info('XMR blocks: %d', callrpc_xmr_na(XMR_BASE_RPC_PORT + 1, 'get_block_count')['count'])
self.btc_addr = callbtcrpc(0, 'getnewaddress', ['mining_addr', 'bech32'])
rv = callbtcrpc(0, 'getblockchaininfo')
print('rv', rv)
num_blocks = 500 # Mine enough to activate segwit
if callbtcrpc(0, 'getblockchaininfo')['blocks'] < num_blocks:
logging.info('Mining %d Bitcoin blocks to %s', num_blocks, self.btc_addr)
@ -288,7 +282,7 @@ class Test(unittest.TestCase):
waitForServer(self.delay_event, UI_PORT + 1)
while not self.delay_event.is_set():
logging.info('Looping indefinitly, ctrl+c to exit.')
logging.info('Looping indefinitely, ctrl+c to exit.')
self.delay_event.wait(10)

@ -8,8 +8,8 @@
"""
export TEST_RELOAD_PATH=/tmp/test_basicswap
mkdir -p ${TEST_RELOAD_PATH}/bin/{particl,bitcoin}
cp ~/tmp/particl-0.19.1.2-x86_64-linux-gnu.tar.gz ${TEST_RELOAD_PATH}/bin/particl
cp ~/tmp/bitcoin-0.20.1-x86_64-linux-gnu.tar.gz ${TEST_RELOAD_PATH}/bin/bitcoin
cp ~/tmp/particl-0.21.0.1-x86_64-linux-gnu.tar.gz ${TEST_RELOAD_PATH}/bin/particl
cp ~/tmp/bitcoin-0.21.0-x86_64-linux-gnu.tar.gz ${TEST_RELOAD_PATH}/bin/bitcoin
export PYTHONPATH=$(pwd)
python tests/basicswap/test_reload.py

@ -101,8 +101,10 @@ def prepareOtherDir(datadir, nodeId, conf_file='litecoin.conf'):
fp.write('debug=1\n')
fp.write('debugexclude=libevent\n')
fp.write('fallbackfee=0.0002\n')
fp.write('wallet=wallet.dat\n')
fp.write('acceptnonstdtxn=0\n')
return node_dir
def prepareDir(datadir, nodeId, network_key, network_pubkey):
@ -127,6 +129,7 @@ def prepareDir(datadir, nodeId, network_key, network_pubkey):
fp.write('debug=1\n')
fp.write('debugexclude=libevent\n')
fp.write('zmqpubsmsg=tcp://127.0.0.1:' + str(BASE_ZMQ_PORT + nodeId) + '\n')
fp.write('wallet=wallet.dat\n')
fp.write('acceptnonstdtxn=0\n')
fp.write('minstakeinterval=2\n')
@ -192,6 +195,8 @@ def prepareDir(datadir, nodeId, network_key, network_pubkey):
with open(settings_path, 'w') as fp:
json.dump(settings, fp, indent=4)
return node_dir
def partRpc(cmd, node_id=0):
return callrpc_cli(cfg.PARTICL_BINDIR, os.path.join(cfg.TEST_DATADIRS, str(node_id)), 'regtest', cmd, cfg.PARTICL_CLI)
@ -263,10 +268,12 @@ class Test(unittest.TestCase):
shutil.rmtree(cfg.TEST_DATADIRS)
for i in range(NUM_NODES):
prepareDir(cfg.TEST_DATADIRS, i, cls.network_key, cls.network_pubkey)
data_dir = prepareDir(cfg.TEST_DATADIRS, i, cls.network_key, cls.network_pubkey)
callrpc_cli(cfg.PARTICL_BINDIR, data_dir, 'regtest', '-wallet=wallet.dat create', 'particl-wallet') # Necessary for 0.21
prepareOtherDir(cfg.TEST_DATADIRS, LTC_NODE)
prepareOtherDir(cfg.TEST_DATADIRS, BTC_NODE, 'bitcoin.conf')
data_dir = prepareOtherDir(cfg.TEST_DATADIRS, BTC_NODE, 'bitcoin.conf')
callrpc_cli(cfg.BITCOIN_BINDIR, data_dir, 'regtest', '-wallet=wallet.dat create', 'bitcoin-wallet') # Necessary for 0.21
cls.daemons = []
cls.swap_clients = []

@ -299,7 +299,9 @@ class Test(unittest.TestCase):
try:
logging.info('Preparing coin nodes.')
for i in range(NUM_NODES):
prepareDataDir(TEST_DIR, i, 'particl.conf', 'part_')
data_dir = prepareDataDir(TEST_DIR, i, 'particl.conf', 'part_')
if os.path.exists(os.path.join(cfg.PARTICL_BINDIR, 'particl-wallet')):
callrpc_cli(cfg.PARTICL_BINDIR, data_dir, 'regtest', '-wallet=wallet.dat create', 'particl-wallet')
cls.part_daemons.append(startDaemon(os.path.join(TEST_DIR, 'part_' + str(i)), cfg.PARTICL_BINDIR, cfg.PARTICLD))
logging.info('Started %s %d', cfg.PARTICLD, cls.part_daemons[-1].pid)
@ -320,7 +322,9 @@ class Test(unittest.TestCase):
rpc('walletsettings', ['stakingoptions', {'stakecombinethreshold': 100, 'stakesplitthreshold': 200}])
for i in range(NUM_BTC_NODES):
prepareDataDir(TEST_DIR, i, 'bitcoin.conf', 'btc_', base_p2p_port=BTC_BASE_PORT, base_rpc_port=BTC_BASE_RPC_PORT)
data_dir = prepareDataDir(TEST_DIR, i, 'bitcoin.conf', 'btc_', base_p2p_port=BTC_BASE_PORT, base_rpc_port=BTC_BASE_RPC_PORT)
if os.path.exists(os.path.join(cfg.BITCOIN_BINDIR, 'bitcoin-wallet')):
callrpc_cli(cfg.BITCOIN_BINDIR, data_dir, 'regtest', '-wallet=wallet.dat create', 'bitcoin-wallet')
cls.btc_daemons.append(startDaemon(os.path.join(TEST_DIR, 'btc_' + str(i)), cfg.BITCOIN_BINDIR, cfg.BITCOIND))
logging.info('Started %s %d', cfg.BITCOIND, cls.part_daemons[-1].pid)

@ -8,7 +8,7 @@
"""
export TEST_RELOAD_PATH=/tmp/test_basicswap
mkdir -p ${TEST_RELOAD_PATH}/bin/{particl,monero}
cp ~/tmp/particl-0.19.1.2-x86_64-linux-gnu.tar.gz ${TEST_RELOAD_PATH}/bin/particl
cp ~/tmp/particl-0.21.0.1-x86_64-linux-gnu.tar.gz ${TEST_RELOAD_PATH}/bin/particl
cp ~/tmp/monero-linux-x64-v0.17.1.9.tar.bz2 ${TEST_RELOAD_PATH}/bin/monero/monero-0.17.1.9-x86_64-linux-gnu.tar.bz2
export PYTHONPATH=$(pwd)
python tests/basicswap/test_xmr_bids_offline.py

@ -8,7 +8,7 @@
"""
export TEST_RELOAD_PATH=/tmp/test_basicswap
mkdir -p ${TEST_RELOAD_PATH}/bin/{particl,monero}
cp ~/tmp/particl-0.19.1.2-x86_64-linux-gnu.tar.gz ${TEST_RELOAD_PATH}/bin/particl
cp ~/tmp/particl-0.21.0.1-x86_64-linux-gnu.tar.gz ${TEST_RELOAD_PATH}/bin/particl
cp ~/tmp/monero-linux-x64-v0.17.1.9.tar.bz2 ${TEST_RELOAD_PATH}/bin/monero/monero-0.17.1.9-x86_64-linux-gnu.tar.bz2
export PYTHONPATH=$(pwd)
python tests/basicswap/test_xmr_reload.py

Loading…
Cancel
Save