mirror of
https://github.com/basicswap/basicswap.git
synced 2025-11-05 18:38:09 +01:00
Store pubkeys in BSX if possible.
This commit is contained in:
@@ -1151,7 +1151,7 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
|
|||||||
# Scan inbox
|
# Scan inbox
|
||||||
# TODO: Redundant? small window for zmq messages to go unnoticed during startup?
|
# TODO: Redundant? small window for zmq messages to go unnoticed during startup?
|
||||||
options = {"encoding": "hex"}
|
options = {"encoding": "hex"}
|
||||||
if self._smsg_plaintext_version >= 2:
|
if self._can_use_smsg_plaintext2:
|
||||||
options["pubkey_from"] = True
|
options["pubkey_from"] = True
|
||||||
ro = self.callrpc("smsginbox", ["unread", "", options])
|
ro = self.callrpc("smsginbox", ["unread", "", options])
|
||||||
nm = 0
|
nm = 0
|
||||||
|
|||||||
@@ -142,6 +142,13 @@ class BSXNetwork:
|
|||||||
elif network["type"] == "simplex":
|
elif network["type"] == "simplex":
|
||||||
initialiseSimplexNetwork(self, network)
|
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:
|
if have_smsg:
|
||||||
self._have_smsg_rpc = True
|
self._have_smsg_rpc = True
|
||||||
if self._zmq_queue_enabled:
|
if self._zmq_queue_enabled:
|
||||||
@@ -205,7 +212,7 @@ class BSXNetwork:
|
|||||||
|
|
||||||
# TODO: Ensure smsg is enabled for the active wallet.
|
# 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])
|
self.callrpc("smsgoptions", ["set", "addReceivedPubkeys", False])
|
||||||
|
|
||||||
now: int = self.getTime()
|
now: int = self.getTime()
|
||||||
@@ -663,6 +670,7 @@ class BSXNetwork:
|
|||||||
if self._smsg_plaintext_version >= 2:
|
if self._smsg_plaintext_version >= 2:
|
||||||
options["plaintext_format_version"] = 2
|
options["plaintext_format_version"] = 2
|
||||||
options["compression"] = 0
|
options["compression"] = 0
|
||||||
|
if self._can_use_smsg_plaintext2:
|
||||||
send_to = self.getPubkeyForAddress(cursor, addr_to).hex()
|
send_to = self.getPubkeyForAddress(cursor, addr_to).hex()
|
||||||
else:
|
else:
|
||||||
send_to = addr_to
|
send_to = addr_to
|
||||||
@@ -744,7 +752,7 @@ class BSXNetwork:
|
|||||||
|
|
||||||
msg_id = message[2:]
|
msg_id = message[2:]
|
||||||
options = {"encoding": "hex", "setread": True}
|
options = {"encoding": "hex", "setread": True}
|
||||||
if self._smsg_plaintext_version >= 2:
|
if self._can_use_smsg_plaintext2:
|
||||||
options["pubkey_from"] = True
|
options["pubkey_from"] = True
|
||||||
num_tries = 5
|
num_tries = 5
|
||||||
for i in range(num_tries + 1):
|
for i in range(num_tries + 1):
|
||||||
@@ -1093,7 +1101,7 @@ class BSXNetwork:
|
|||||||
if now - self._last_checked_smsg >= self.check_smsg_seconds:
|
if now - self._last_checked_smsg >= self.check_smsg_seconds:
|
||||||
self._last_checked_smsg = now
|
self._last_checked_smsg = now
|
||||||
options = {"encoding": "hex", "setread": True}
|
options = {"encoding": "hex", "setread": True}
|
||||||
if self._smsg_plaintext_version >= 2:
|
if self._can_use_smsg_plaintext2:
|
||||||
options["pubkey_from"] = True
|
options["pubkey_from"] = True
|
||||||
msgs = self.callrpc("smsginbox", ["unread", "", options])
|
msgs = self.callrpc("smsginbox", ["unread", "", options])
|
||||||
for msg in msgs["messages"]:
|
for msg in msgs["messages"]:
|
||||||
|
|||||||
Reference in New Issue
Block a user