Update BITCOIN_FASTSYNC_URL

This commit is contained in:
tecnovert 2023-03-28 15:47:29 +02:00
parent 409c75851f
commit 6e94c4a05d
No known key found for this signature in database
GPG key ID: 8ED6D8750C4E3F93
3 changed files with 31 additions and 6 deletions

View file

@ -166,8 +166,8 @@ TOR_DNS_PORT = int(os.getenv('TOR_DNS_PORT', 5353))
TEST_TOR_PROXY = toBool(os.getenv('TEST_TOR_PROXY', 'true')) # Expects a known exit node TEST_TOR_PROXY = toBool(os.getenv('TEST_TOR_PROXY', 'true')) # Expects a known exit node
TEST_ONION_LINK = toBool(os.getenv('TEST_ONION_LINK', 'false')) TEST_ONION_LINK = toBool(os.getenv('TEST_ONION_LINK', 'false'))
BITCOIN_FASTSYNC_URL = os.getenv('BITCOIN_FASTSYNC_URL', 'http://utxosets.blob.core.windows.net/public/') BITCOIN_FASTSYNC_URL = os.getenv('BITCOIN_FASTSYNC_URL', 'https://eu2.contabostorage.com/1f50a74c9dc14888a8664415dad3d020:utxosets/')
BITCOIN_FASTSYNC_FILE = os.getenv('BITCOIN_FASTSYNC_FILE', 'utxo-snapshot-bitcoin-mainnet-720179.tar') BITCOIN_FASTSYNC_FILE = os.getenv('BITCOIN_FASTSYNC_FILE', 'utxo-snapshot-bitcoin-mainnet-769818.tar')
# Encrypt new wallets with this password, must match the Particl wallet password when adding coins # Encrypt new wallets with this password, must match the Particl wallet password when adding coins
WALLET_ENCRYPTION_PWD = os.getenv('WALLET_ENCRYPTION_PWD', '') WALLET_ENCRYPTION_PWD = os.getenv('WALLET_ENCRYPTION_PWD', '')
@ -872,7 +872,8 @@ def prepareDataDir(coin, settings, chain, particl_mnemonic, extra_opts={}):
raise ValueError(f'BTC fastsync file not found: {sync_file_path}') raise ValueError(f'BTC fastsync file not found: {sync_file_path}')
# Double check # Double check
check_btc_fastsync_data(base_dir, sync_file_path) if extra_opts.get('check_btc_fastsync', True):
check_btc_fastsync_data(base_dir, sync_file_path)
with tarfile.open(sync_file_path) as ft: with tarfile.open(sync_file_path) as ft:
ft.extractall(path=data_dir) ft.extractall(path=data_dir)
@ -1028,6 +1029,7 @@ def printHelp():
print('--disabletor Setup Basicswap instance to not use TOR.') print('--disabletor Setup Basicswap instance to not use TOR.')
print('--usebtcfastsync Initialise the BTC chain with a snapshot from btcpayserver FastSync.\n' print('--usebtcfastsync Initialise the BTC chain with a snapshot from btcpayserver FastSync.\n'
+ ' See https://github.com/btcpayserver/btcpayserver-docker/blob/master/contrib/FastSync/README.md') + ' See https://github.com/btcpayserver/btcpayserver-docker/blob/master/contrib/FastSync/README.md')
print('--skipbtcfastsyncchecks Use the provided btcfastsync file without checking it\'s size or signature .')
print('--initwalletsonly Setup coin wallets only.') print('--initwalletsonly Setup coin wallets only.')
print('--keysdirpath Speed up tests by preloading all PGP keys in directory.') print('--keysdirpath Speed up tests by preloading all PGP keys in directory.')
@ -1289,6 +1291,9 @@ def main():
if name == 'usebtcfastsync': if name == 'usebtcfastsync':
extra_opts['use_btc_fastsync'] = True extra_opts['use_btc_fastsync'] = True
continue continue
if name == 'skipbtcfastsyncchecks':
extra_opts['check_btc_fastsync'] = False
continue
if name == 'initwalletsonly': if name == 'initwalletsonly':
initwalletsonly = True initwalletsonly = True
continue continue
@ -1376,13 +1381,14 @@ def main():
sync_file_path = os.path.join(data_dir, BITCOIN_FASTSYNC_FILE) sync_file_path = os.path.join(data_dir, BITCOIN_FASTSYNC_FILE)
sync_file_url = os.path.join(BITCOIN_FASTSYNC_URL, BITCOIN_FASTSYNC_FILE) sync_file_url = os.path.join(BITCOIN_FASTSYNC_URL, BITCOIN_FASTSYNC_FILE)
try: try:
check_btc_fastsync = extra_opts.get('check_btc_fastsync', True)
check_sig = False check_sig = False
remote_file = urlopen(sync_file_url)
if not os.path.exists(sync_file_path): if not os.path.exists(sync_file_path):
downloadFile(sync_file_url, sync_file_path, timeout=50) downloadFile(sync_file_url, sync_file_path, timeout=50)
check_sig = True check_sig = check_btc_fastsync
else: elif check_btc_fastsync:
file_size = os.stat(sync_file_path).st_size file_size = os.stat(sync_file_path).st_size
remote_file = urlopen(sync_file_url)
if file_size < remote_file.length: if file_size < remote_file.length:
logger.warning(f'{BITCOIN_FASTSYNC_FILE} is an unexpected size, {file_size} < {remote_file.length}') logger.warning(f'{BITCOIN_FASTSYNC_FILE} is an unexpected size, {file_size} < {remote_file.length}')
downloadFile(sync_file_url, sync_file_path, timeout=50, resume_from=file_size) downloadFile(sync_file_url, sync_file_path, timeout=50, resume_from=file_size)

View file

@ -9,6 +9,9 @@
- Ensure messages are always sent from and to the expected addresses. - Ensure messages are always sent from and to the expected addresses.
- ui: Add pagination and filters to smsgaddresses page. - ui: Add pagination and filters to smsgaddresses page.
- Removed dependency on particl-tx. - Removed dependency on particl-tx.
- Updated btcfastsync urls and signatures, added --skipbtcfastsyncchecks option to basicswap-prepare
- If --skipbtcfastsyncchecks is set the script will use any file with a name matching the
BITCOIN_FASTSYNC_FILE env var in the datadir without checking it's size or signature.
0.0.59 0.0.59

View file

@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEEjlF9wS7BzDf2QjqKE/E2UcnPDWsFAmQi+4wACgkQE/E2UcnP
DWsWphAAojXsC/l8wLD0Gl5hJd7KedhJ51vb/AsyW8uIzRERkbHwKio0zzIv2Tnf
USDenV+/NhI9sPKwga+klxayK7CYlYEa6a3JUrsp4OWuDZ35Sln8OjX6T8m67uoN
diIBHXhIyZUmKYheWKin3X9ZWTLwCcmdnkGKb2cw0EkrYsmSRrPuf8KrxjTmkm58
Olp4mC26XQX87ID7w6yLPrhWSnyVblf3Bao35nGKr6JgAfsO7DN9mqPbZyNeBopH
29OphTJJuFXIbTh7IcjYUuSIwWT40o3w/QnQeDk1vcHljS53gldFj9mbFP04bqgs
pfF5JAdP93hYVHysbaVaZZI1VbkHinfC40CioXW9bO42Qw7VPVkYSzlQfG9f2JpX
i2uEF4xC9v5iaHrO/lXG4U4Vpf0ShVKiV5NgQMeIyk39thg8GPYwy7XXzARfk5v0
xSDMgfR6ScsQR5/0ktMIyazCw8cnxTvjPs6bMvbP6QNoH1G2fZ/4hBrP/untZ/Ik
iaHk88U/MOTpSZku6lQSq5rdX1/WlnDBozM6huWi+eywovV4zbjHUpuKFze7fmvu
VGOubad2ZFufNyE+cNia9ez52JqnoUdgoN1J1ut/9LDVOZyimMmi2H3l2+aX1rYg
sY5Jm27FhICsYSFOC6zxCfpsAi1rWxCJ81j9Rk6D9drn9Fzyq+w=
=DKWQ
-----END PGP SIGNATURE-----