diff --git a/basicswap/chainparams.py b/basicswap/chainparams.py index bb79cb5..49ee7a2 100644 --- a/basicswap/chainparams.py +++ b/basicswap/chainparams.py @@ -242,7 +242,7 @@ chainparams = { "pubkey_address": 0x0E91, "script_address": 0x0E6C, "key_prefix": 0x2307, - "bip44": 1, + "bip44": 115, "min_amount": 100000, "max_amount": 10000000 * COIN, }, diff --git a/basicswap/interface/dcr/dcr.py b/basicswap/interface/dcr/dcr.py index b6ea07f..5872737 100644 --- a/basicswap/interface/dcr/dcr.py +++ b/basicswap/interface/dcr/dcr.py @@ -406,7 +406,10 @@ class DCRInterface(Secp256k1Interface): # Adjust verificationprogress to consider blocks wallet has synced wallet_blocks = self.rpc_wallet("getinfo")["blocks"] synced_ind = bci["verificationprogress"] - wallet_synced_ind = wallet_blocks / bci["headers"] + if bci["headers"] < 1: + wallet_synced_ind = 0 + else: + wallet_synced_ind = wallet_blocks / bci["headers"] if wallet_synced_ind < synced_ind: bci["verificationprogress"] = wallet_synced_ind diff --git a/basicswap/interface/dcr/util.py b/basicswap/interface/dcr/util.py index cb8bbb8..b49de29 100644 --- a/basicswap/interface/dcr/util.py +++ b/basicswap/interface/dcr/util.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Copyright (c) 2024 tecnovert +# Copyright (c) 2025 The Basicswap developers # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. @@ -35,6 +36,13 @@ def createDCRWallet(args, hex_seed, logging, delay_event): response = b"y\n" elif "Enter existing wallet seed" in buf: response = (hex_seed + "\n").encode("utf-8") + elif "Do you have a wallet birthday we should rescan from" in buf: + response = b"no\n" + elif ( + "Do you have an additional account to import from an extended public key" + in buf + ): + response = b"no\n" elif "Seed input successful" in buf: pass elif "Upgrading database from version" in buf: diff --git a/tests/basicswap/extended/test_dcr.py b/tests/basicswap/extended/test_dcr.py index 046fa21..0e13ed9 100644 --- a/tests/basicswap/extended/test_dcr.py +++ b/tests/basicswap/extended/test_dcr.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # Copyright (c) 2024 tecnovert -# Copyright (c) 2024 The Basicswap developers +# Copyright (c) 2024-2025 The Basicswap developers # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. @@ -689,7 +689,7 @@ def prepareDCDDataDir(datadir, node_id, conf_file, dir_prefix, num_nodes=3): "noseeders=1\n", "nodnsseed=1\n", "nodiscoverip=1\n", - "miningaddr=SsYbXyjkKAEXXcGdFgr4u4bo4L8RkCxwQpH\n", + "miningaddr=SsppG7KLiH52NC7iJmUVGVq89FLS83E5vho\n", ] for i in range(0, num_nodes): @@ -725,7 +725,8 @@ class Test(BaseTest): dcr_daemons = [] start_ltc_nodes = False start_xmr_nodes = True - dcr_mining_addr = "SsYbXyjkKAEXXcGdFgr4u4bo4L8RkCxwQpH" + # Addresses differ after 2.1.2, simnet bip44id changed from 1 to 115 + dcr_mining_addr = "SsppG7KLiH52NC7iJmUVGVq89FLS83E5vho" extra_wait_time = 0 max_fee: int = 10000 @@ -739,7 +740,8 @@ class Test(BaseTest): def prepareExtraCoins(cls): ci0 = cls.swap_clients[0].ci(cls.test_coin) if not cls.restore_instance: - assert ci0.rpc_wallet("getnewaddress") == cls.dcr_mining_addr + dcr_mining_addr = ci0.rpc_wallet("getnewaddress") + assert dcr_mining_addr in cls.dcr_mining_addrs cls.dcr_ticket_account = ci0.rpc_wallet( "getaccount", [ @@ -776,7 +778,7 @@ class Test(BaseTest): num_passed: int = 0 for i in range(30): try: - ci0.rpc_wallet("purchaseticket", [cls.dcr_ticket_account, 0.1, 0]) + ci0.rpc_wallet("purchaseticket", [cls.dcr_ticket_account, 0, 1]) num_passed += 1 if num_passed >= 5: break @@ -902,14 +904,14 @@ class Test(BaseTest): masterpubkey = loop_ci.rpc_wallet("getmasterpubkey") masterpubkey_data = loop_ci.decode_address(masterpubkey)[4:] - seed_hash = loop_ci.getSeedHash(root_key) + seed_hash: bytes = loop_ci.getSeedHash(root_key) if i == 0: assert ( masterpubkey - == "spubVV1z2AFYjVZvzM45FSaWMPRqyUoUwyW78wfANdjdNG6JGCXrr8AbRvUgYb3Lm1iun9CgHew1KswdePryNLKEnBSQ82AjNpYdQgzXPUme9c6" + == "spubVUjNdu1HtDuQYHjVLTgdK3JKtC7JQoCUkhkoVn3rJt6kYctRksn4vTGsdV3obeZLHaB1YobsLENYKHjtey67LFZJdjJyAvHuRqgFRpaSmfn" ) if i < 2: - assert seed_hash == hash160(masterpubkey_data) + assert hash160(masterpubkey_data) == seed_hash def test_001_segwit(self): logging.info("---------- Test {} segwit".format(self.test_coin.name))