Add preparebinonly option to basicswap-prepare,

Download, verify and extract coin cores only.
This commit is contained in:
tecnovert 2019-07-25 14:06:58 +02:00
parent 9aa7e441ee
commit bd93899066
No known key found for this signature in database
GPG Key ID: 8ED6D8750C4E3F93
5 changed files with 23 additions and 8 deletions

View File

@ -40,6 +40,6 @@ jobs:
before_script: before_script:
script: script:
- PYTHONWARNINGS="ignore" flake8 --ignore=E501,F841 --exclude=key.py,messages_pb2.py,.eggs - PYTHONWARNINGS="ignore" flake8 --ignore=E501,F841 --exclude=key.py,messages_pb2.py,.eggs
- codespell --check-filenames --disable-colors --quiet-level=7 -S .git,.eggs - codespell --check-filenames --disable-colors --quiet-level=7 -S .git,.eggs,gitianpubkeys
after_success: after_success:
- echo "End lint" - echo "End lint"

View File

@ -14,7 +14,7 @@ RUN wget -O bs.zip https://github.com/tecnovert/basicswap/archive/master.zip; \
pip3 install .; pip3 install .;
# Download binaries, these will be part of the docker image # Download binaries, these will be part of the docker image
RUN basicswap-prepare -datadir=/opt --particl_mnemonic=none RUN basicswap-prepare -datadir=/opt -preparebinonly
RUN useradd -ms /bin/bash user; \ RUN useradd -ms /bin/bash user; \
mkdir /coindata && chown user /coindata mkdir /coindata && chown user /coindata

View File

@ -29,6 +29,8 @@ from .basicswap import (
getBidState, getBidState,
getTxState, getTxState,
getLockName, getLockName,
SEQUENCE_LOCK_TIME,
ABS_LOCK_TIME,
) )

View File

@ -235,11 +235,13 @@ def printHelp():
logger.info('--mainnet Run in mainnet mode.') logger.info('--mainnet Run in mainnet mode.')
logger.info('--testnet Run in testnet mode.') logger.info('--testnet Run in testnet mode.')
logger.info('--regtest Run in regtest mode.') logger.info('--regtest Run in regtest mode.')
logger.info('--particl_mnemonic= Recovery phrase to use for the Particl wallet, default is randomly generated,\n' logger.info('--particl_mnemonic= Recovery phrase to use for the Particl wallet, default is randomly generated,\n' +
+ ' "none" to set autogenerate account mode.') ' "none" to set autogenerate account mode.')
logger.info('--withcoin= Prepare system to run daemon for coin.') logger.info('--withcoin= Prepare system to run daemon for coin.')
logger.info('--withoutcoin= Do not prepare system to run daemon for coin.') logger.info('--withoutcoin= Do not prepare system to run daemon for coin.')
logger.info('--addcoin= Add coin to existing setup.') logger.info('--addcoin= Add coin to existing setup.')
logger.info('--preparebinonly Don\'t prepare settings or datadirs.')
logger.info('\n' + 'Known coins: %s', ', '.join(known_coins.keys())) logger.info('\n' + 'Known coins: %s', ', '.join(known_coins.keys()))
@ -276,6 +278,7 @@ def main():
data_dir = None data_dir = None
chain = 'mainnet' chain = 'mainnet'
particl_wallet_mnemonic = None particl_wallet_mnemonic = None
prepare_bin_only = False
with_coins = {'particl', 'litecoin'} with_coins = {'particl', 'litecoin'}
add_coin = '' add_coin = ''
@ -304,6 +307,9 @@ def main():
if name == 'regtest': if name == 'regtest':
chain = 'regtest' chain = 'regtest'
continue continue
if name == 'preparebinonly':
prepare_bin_only = True
continue
if len(s) == 2: if len(s) == 2:
if name == 'datadir': if name == 'datadir':
@ -424,12 +430,19 @@ def main():
continue continue
coin = c coin = c
prepareCore(coin, v, settings, data_dir) prepareCore(coin, v, settings, data_dir)
if prepare_bin_only:
logger.info('Done.')
return 0
for c, v in known_coins.items():
if c not in with_coins:
continue
prepareDataDir(coin, settings, data_dir, chain, particl_wallet_mnemonic) prepareDataDir(coin, settings, data_dir, chain, particl_wallet_mnemonic)
with open(config_path, 'w') as fp: with open(config_path, 'w') as fp:
json.dump(settings, fp, indent=4) json.dump(settings, fp, indent=4)
if particl_wallet_mnemonic == 'none': if particl_wallet_mnemonic == 'none':
logger.info('Done.') logger.info('Done.')
return 0 return 0