From d0978467569699aa7c12e7ab73b134b7e19f28ed Mon Sep 17 00:00:00 2001 From: tecnovert Date: Thu, 3 Oct 2024 14:28:24 +0200 Subject: [PATCH] cores: Update DASH version to 21.1 --- basicswap/interface/btc.py | 2 +- basicswap/interface/dash.py | 27 ++++----------------------- basicswap/interface/nav.py | 3 --- basicswap/js_server.py | 2 -- bin/basicswap_prepare.py | 7 ++++--- 5 files changed, 9 insertions(+), 32 deletions(-) diff --git a/basicswap/interface/btc.py b/basicswap/interface/btc.py index baded69..1a93f0d 100644 --- a/basicswap/interface/btc.py +++ b/basicswap/interface/btc.py @@ -367,7 +367,7 @@ class BTCInterface(Secp256k1Interface): wi = self.rpc_wallet('getwalletinfo') return 'Not found' if 'hdseedid' not in wi else wi['hdseedid'] - def checkExpectedSeed(self, expect_seedid) -> bool: + def checkExpectedSeed(self, expect_seedid: str) -> bool: self._expect_seedid_hex = expect_seedid return expect_seedid == self.getWalletSeedID() diff --git a/basicswap/interface/dash.py b/basicswap/interface/dash.py index 3471d86..0caf04f 100644 --- a/basicswap/interface/dash.py +++ b/basicswap/interface/dash.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (c) 2022 tecnovert +# Copyright (c) 2022-2024 tecnovert # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. @@ -25,31 +25,12 @@ class DASHInterface(BTCInterface): self._wallet_passphrase = '' self._have_checked_seed = False - def entropyToMnemonic(self, key: bytes) -> str: - return Mnemonic('english').to_mnemonic(key) - - def initialiseWallet(self, key: bytes): - words = self.entropyToMnemonic(key) - - mnemonic_passphrase = '' - self.rpc_wallet('upgradetohd', [words, mnemonic_passphrase, self._wallet_passphrase]) - self._have_checked_seed = False - if self._wallet_passphrase != '': - self.unlockWallet(self._wallet_passphrase) - def decodeAddress(self, address: str) -> bytes: return decodeAddress(address)[1:] - def checkExpectedSeed(self, key_hash: str): - try: - rv = self.rpc_wallet('dumphdinfo') - entropy = Mnemonic('english').to_entropy(rv['mnemonic'].split(' ')) - entropy_hash = self.getAddressHashFromKey(entropy)[::-1].hex() - self._have_checked_seed = True - return entropy_hash == key_hash - except Exception as e: - self._log.warning('checkExpectedSeed failed: {}'.format(str(e))) - return False + def getWalletSeedID(self) -> str: + hdseed: str = self.rpc_wallet('dumphdinfo')['hdseed'] + return self.getSeedHash(bytes.fromhex(hdseed)).hex() def withdrawCoin(self, value, addr_to, subfee): params = [addr_to, value, '', '', subfee, False, False, self._conf_target] diff --git a/basicswap/interface/nav.py b/basicswap/interface/nav.py index c467096..752d630 100644 --- a/basicswap/interface/nav.py +++ b/basicswap/interface/nav.py @@ -77,9 +77,6 @@ class NAVInterface(BTCInterface): # p2sh-p2wsh return True - def entropyToMnemonic(self, key: bytes) -> None: - return Mnemonic('english').to_mnemonic(key) - def initialiseWallet(self, key): # Load with -importmnemonic= parameter pass diff --git a/basicswap/js_server.py b/basicswap/js_server.py index 10c9c99..8bf9853 100644 --- a/basicswap/js_server.py +++ b/basicswap/js_server.py @@ -692,8 +692,6 @@ def js_getcoinseed(self, url_split, post_string, is_json) -> bytes: return bytes(json.dumps({'coin': ci.ticker(), 'key_view': ci.encodeKey(key_view), 'key_spend': ci.encodeKey(key_spend), 'address': address}), 'UTF-8') seed_key = swap_client.getWalletKey(coin, 1) - if coin == Coins.DASH: - return bytes(json.dumps({'coin': ci.ticker(), 'seed': seed_key.hex(), 'mnemonic': ci.entropyToMnemonic(seed_key)}), 'UTF-8') seed_id = ci.getSeedHash(seed_key) return bytes(json.dumps({'coin': ci.ticker(), 'seed': seed_key.hex(), 'seed_id': seed_id.hex()}), 'UTF-8') diff --git a/bin/basicswap_prepare.py b/bin/basicswap_prepare.py index 0684917..32c15b7 100755 --- a/bin/basicswap_prepare.py +++ b/bin/basicswap_prepare.py @@ -60,7 +60,7 @@ WOW_SITE_COMMIT = '97e100e1605e9f59bc8ca82a5b237d5562c8a21c' # Lock hashes.txt PIVX_VERSION = os.getenv('PIVX_VERSION', '5.6.1') PIVX_VERSION_TAG = os.getenv('PIVX_VERSION_TAG', '') -DASH_VERSION = os.getenv('DASH_VERSION', '20.0.2') +DASH_VERSION = os.getenv('DASH_VERSION', '21.1.0') DASH_VERSION_TAG = os.getenv('DASH_VERSION_TAG', '') FIRO_VERSION = os.getenv('FIRO_VERSION', '0.14.14.0') @@ -707,7 +707,8 @@ def prepareCore(coin, version_data, settings, data_dir, extra_opts={}): release_filename = '{}-{}-{}.{}'.format('dashcore', version + version_tag, arch_name, FILE_EXT) release_url = 'https://github.com/dashpay/dash/releases/download/v{}/{}'.format(version + version_tag, release_filename) assert_filename = '{}-{}-{}-build.assert'.format(coin, arch_name, major_version) - assert_url = f'https://raw.githubusercontent.com/dashpay/guix.sigs/master/{version}/{signing_key_name}/codesigned.SHA256SUMS' + sums_name = 'all' if major_version >= 21 else 'codesigned' + assert_url = f'https://raw.githubusercontent.com/dashpay/guix.sigs/master/{version}/{signing_key_name}/{sums_name}.SHA256SUMS' elif coin == 'firo': arch_name = BIN_ARCH if BIN_ARCH == 'x86_64-linux-gnu': @@ -1382,7 +1383,7 @@ def initialise_wallets(particl_wallet_mnemonic, with_coins, data_dir, settings, if len(wallets) < 1: logger.info('Creating wallet.dat for {}.'.format(getCoinName(c))) - if c in (Coins.BTC, Coins.LTC): + if c in (Coins.BTC, Coins.LTC, Coins.DASH): # wallet_name, disable_private_keys, blank, passphrase, avoid_reuse, descriptors swap_client.callcoinrpc(c, 'createwallet', ['wallet.dat', False, True, WALLET_ENCRYPTION_PWD, False, False]) swap_client.ci(c).unlockWallet(WALLET_ENCRYPTION_PWD)