Store pubkeys in BSX if possible.

This commit is contained in:
tecnovert
2025-07-31 00:36:16 +02:00
parent f932a41b1a
commit 4ba2b877dd
2 changed files with 12 additions and 4 deletions

View File

@@ -1151,7 +1151,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
# Scan inbox
# TODO: Redundant? small window for zmq messages to go unnoticed during startup?
options = {"encoding": "hex"}
if self._smsg_plaintext_version >= 2:
if self._can_use_smsg_plaintext2:
options["pubkey_from"] = True
ro = self.callrpc("smsginbox", ["unread", "", options])
nm = 0

View File

@@ -142,6 +142,13 @@ class BSXNetwork:
elif network["type"] == "simplex":
initialiseSimplexNetwork(self, network)
self._can_use_smsg_plaintext2 = False
if (
Coins.PART in self.coin_clients
and self.coin_clients[Coins.PART]["core_version"] > 23020700
):
self._can_use_smsg_plaintext2 = True
if have_smsg:
self._have_smsg_rpc = True
if self._zmq_queue_enabled:
@@ -205,7 +212,7 @@ class BSXNetwork:
# TODO: Ensure smsg is enabled for the active wallet.
if self._smsg_plaintext_version >= 2:
if self._can_use_smsg_plaintext2:
self.callrpc("smsgoptions", ["set", "addReceivedPubkeys", False])
now: int = self.getTime()
@@ -663,6 +670,7 @@ class BSXNetwork:
if self._smsg_plaintext_version >= 2:
options["plaintext_format_version"] = 2
options["compression"] = 0
if self._can_use_smsg_plaintext2:
send_to = self.getPubkeyForAddress(cursor, addr_to).hex()
else:
send_to = addr_to
@@ -744,7 +752,7 @@ class BSXNetwork:
msg_id = message[2:]
options = {"encoding": "hex", "setread": True}
if self._smsg_plaintext_version >= 2:
if self._can_use_smsg_plaintext2:
options["pubkey_from"] = True
num_tries = 5
for i in range(num_tries + 1):
@@ -1093,7 +1101,7 @@ class BSXNetwork:
if now - self._last_checked_smsg >= self.check_smsg_seconds:
self._last_checked_smsg = now
options = {"encoding": "hex", "setread": True}
if self._smsg_plaintext_version >= 2:
if self._can_use_smsg_plaintext2:
options["pubkey_from"] = True
msgs = self.callrpc("smsginbox", ["unread", "", options])
for msg in msgs["messages"]: