From 7ee1931176dc9e8efb7040773f83813324845c63 Mon Sep 17 00:00:00 2001 From: tecnovert Date: Wed, 6 Aug 2025 15:12:20 +0200 Subject: [PATCH] prepare: Set Particl version to 27.2.2.0 Fixes zmq missing curve functions. Fix signmessage for v23. --- basicswap/bin/prepare.py | 5 +++-- basicswap/interface/base.py | 1 + basicswap/interface/btc.py | 4 +++- basicswap/interface/part.py | 18 ++++++++++++++---- basicswap/interface/xmr.py | 5 ++++- basicswap/network/bsx_network.py | 7 ++----- 6 files changed, 27 insertions(+), 13 deletions(-) diff --git a/basicswap/bin/prepare.py b/basicswap/bin/prepare.py index 3ad1f32..7e257bd 100755 --- a/basicswap/bin/prepare.py +++ b/basicswap/bin/prepare.py @@ -51,7 +51,7 @@ from basicswap.bin.run import ( # Coin clients PARTICL_REPO = os.getenv("PARTICL_REPO", "tecnovert") -PARTICL_VERSION = os.getenv("PARTICL_VERSION", "27.2.1.0") +PARTICL_VERSION = os.getenv("PARTICL_VERSION", "27.2.2.0") PARTICL_VERSION_TAG = os.getenv("PARTICL_VERSION_TAG", "") PARTICL_LINUX_EXTRA = os.getenv("PARTICL_LINUX_EXTRA", "nousb") @@ -1369,7 +1369,8 @@ def prepareDataDir(coin, settings, chain, particl_mnemonic, extra_opts={}): if coin == "particl": fp.write("deprecatedrpc=create_bdb\n") fp.write("debugexclude=libevent\n") - fp.write("rpcdoccheck=0\n") + if chain == "mainnet": + fp.write("rpcdoccheck=0\n") fp.write( "zmqpubsmsg=tcp://{}:{}\n".format(COINS_RPCBIND_IP, settings["zmqport"]) ) diff --git a/basicswap/interface/base.py b/basicswap/interface/base.py index be31631..6069397 100644 --- a/basicswap/interface/base.py +++ b/basicswap/interface/base.py @@ -53,6 +53,7 @@ class CoinInterface: self._network = network self._mx_wallet = threading.Lock() self._altruistic = True + self._core_version = None # Set in getDaemonVersion() def interface_type(self) -> int: # coin_type() returns the base coin type, interface_type() returns the coin+balance type. diff --git a/basicswap/interface/btc.py b/basicswap/interface/btc.py index 4631e1e..62d1e7a 100644 --- a/basicswap/interface/btc.py +++ b/basicswap/interface/btc.py @@ -364,7 +364,9 @@ class BTCInterface(Secp256k1Interface): self.rpc_wallet("getwalletinfo" if with_wallet else "getblockchaininfo") def getDaemonVersion(self): - return self.rpc("getnetworkinfo")["version"] + if self._core_version is None: + self._core_version = self.rpc("getnetworkinfo")["version"] + return self._core_version def getBlockchainInfo(self): return self.rpc("getblockchaininfo") diff --git a/basicswap/interface/part.py b/basicswap/interface/part.py index e4a5949..48890b6 100644 --- a/basicswap/interface/part.py +++ b/basicswap/interface/part.py @@ -191,12 +191,22 @@ class PARTInterface(BTCInterface): raise RuntimeError("No non-segwit outputs found.") def signMessage(self, address: str, message: str) -> str: - message_magic: str = self.chainparams()["message_magic"] - return self.rpc_wallet("signmessage", [address, message, message_magic]) + args = [address, message] + if self.getDaemonVersion() > 23020700: + message_magic: str = self.chainparams()["message_magic"] + args += [ + message_magic, + ] + return self.rpc_wallet("signmessage", args) def signMessageWithKey(self, key_wif: str, message: str) -> str: - message_magic: str = self.chainparams()["message_magic"] - return self.rpc("signmessagewithprivkey", [key_wif, message, message_magic]) + args = [key_wif, message] + if self.getDaemonVersion() > 23020700: + message_magic: str = self.chainparams()["message_magic"] + args += [ + message_magic, + ] + return self.rpc("signmessagewithprivkey", args) class PARTInterfaceBlind(PARTInterface): diff --git a/basicswap/interface/xmr.py b/basicswap/interface/xmr.py index c5c9a8e..f8d8b3e 100644 --- a/basicswap/interface/xmr.py +++ b/basicswap/interface/xmr.py @@ -287,7 +287,10 @@ class XMRInterface(CoinInterface): self.rpc_wallet("get_languages") def getDaemonVersion(self): - return self.rpc_wallet("get_version")["version"] + # Returns wallet version + if self._core_version is None: + self._core_version = self.rpc_wallet("get_version")["version"] + return self._core_version def getBlockchainInfo(self): get_height = self.rpc2("get_height", timeout=self._rpctimeout) diff --git a/basicswap/network/bsx_network.py b/basicswap/network/bsx_network.py index 02eca9d..94ada8f 100644 --- a/basicswap/network/bsx_network.py +++ b/basicswap/network/bsx_network.py @@ -169,6 +169,8 @@ class BSXNetwork: if have_smsg: self._have_smsg_rpc = True + if self._can_use_smsg_payload2: + self.callrpc("smsgoptions", ["set", "addReceivedPubkeys", False]) if self._zmq_queue_enabled: self.zmqContext = zmq.Context() self.zmqSubscriber = self.zmqContext.socket(zmq.SUB) @@ -228,11 +230,6 @@ class BSXNetwork: finally: self.closeDB(cursor) - # TODO: Ensure smsg is enabled for the active wallet. - - if self._can_use_smsg_payload2: - self.callrpc("smsgoptions", ["set", "addReceivedPubkeys", False]) - now: int = self.getTime() # Load portal data