ux: revert xmr universal refresh to fix regression

This commit is contained in:
nahuhh
2025-03-02 18:37:51 +00:00
parent a5c3c692a0
commit 07bd7d3bd0

View File

@@ -201,8 +201,6 @@ class XMRInterface(CoinInterface):
try: try:
self.rpc_wallet("open_wallet", params) self.rpc_wallet("open_wallet", params)
# TODO Remove `refresh` after upstream fix to refresh on open_wallet
self.rpc_wallet("refresh")
except Exception as e: except Exception as e:
if "no connection to daemon" in str(e): if "no connection to daemon" in str(e):
self._log.debug(f"{self.coin_name()} {e}") self._log.debug(f"{self.coin_name()} {e}")
@@ -217,8 +215,6 @@ class XMRInterface(CoinInterface):
pass pass
self.rpc_wallet("open_wallet", params) self.rpc_wallet("open_wallet", params)
# TODO Remove `refresh` after upstream fix to refresh on open_wallet
self.rpc_wallet("refresh")
self._log.debug(f"Reattempt to open {self.coin_name()} wallet") self._log.debug(f"Reattempt to open {self.coin_name()} wallet")
def initialiseWallet( def initialiseWallet(
@@ -305,6 +301,8 @@ class XMRInterface(CoinInterface):
raise e raise e
rv = {} rv = {}
self.rpc_wallet("refresh")
self._log.debug(f"Refreshing {self.coin_name()} wallet")
balance_info = self.rpc_wallet("get_balance") balance_info = self.rpc_wallet("get_balance")
rv["wallet_blocks"] = self.rpc_wallet("get_height")["height"] rv["wallet_blocks"] = self.rpc_wallet("get_height")["height"]
@@ -406,6 +404,8 @@ class XMRInterface(CoinInterface):
) -> bytes: ) -> bytes:
with self._mx_wallet: with self._mx_wallet:
self.openWallet(self._wallet_filename) self.openWallet(self._wallet_filename)
self.rpc_wallet("refresh")
self._log.debug(f"Refreshing {self.coin_name()} wallet")
Kbv = self.getPubkey(kbv) Kbv = self.getPubkey(kbv)
shared_addr = xmr_util.encode_address(Kbv, Kbs, self._addr_prefix) shared_addr = xmr_util.encode_address(Kbv, Kbs, self._addr_prefix)
@@ -447,6 +447,9 @@ class XMRInterface(CoinInterface):
self.createWallet(params) self.createWallet(params)
self.openWallet(address_b58) self.openWallet(address_b58)
self.rpc_wallet("refresh")
self._log.debug(f"Refreshing {self.coin_name()} wallet")
""" """
# Debug # Debug
try: try:
@@ -498,6 +501,8 @@ class XMRInterface(CoinInterface):
def findTxnByHash(self, txid): def findTxnByHash(self, txid):
with self._mx_wallet: with self._mx_wallet:
self.openWallet(self._wallet_filename) self.openWallet(self._wallet_filename)
self.rpc_wallet("refresh")
self._log.debug(f"Refreshing {self.coin_name()} wallet")
try: try:
current_height = self.rpc2("get_height", timeout=self._rpctimeout)[ current_height = self.rpc2("get_height", timeout=self._rpctimeout)[
@@ -566,6 +571,8 @@ class XMRInterface(CoinInterface):
self.createWallet(params) self.createWallet(params)
self.openWallet(wallet_filename) self.openWallet(wallet_filename)
self.rpc_wallet("refresh")
self._log.debug(f"Refreshing {self.coin_name()} wallet")
rv = self.rpc_wallet("get_balance") rv = self.rpc_wallet("get_balance")
if rv["balance"] < cb_swap_value: if rv["balance"] < cb_swap_value:
self._log.warning("Balance is too low, checking for existing spend.") self._log.warning("Balance is too low, checking for existing spend.")
@@ -620,6 +627,8 @@ class XMRInterface(CoinInterface):
) -> str: ) -> str:
with self._mx_wallet: with self._mx_wallet:
self.openWallet(self._wallet_filename) self.openWallet(self._wallet_filename)
self.rpc_wallet("refresh")
self._log.debug(f"Refreshing {self.coin_name()} wallet")
if sweepall: if sweepall:
balance = self.rpc_wallet("get_balance") balance = self.rpc_wallet("get_balance")
@@ -699,6 +708,9 @@ class XMRInterface(CoinInterface):
self.createWallet(params) self.createWallet(params)
self.openWallet(address_b58) self.openWallet(address_b58)
self.rpc_wallet("refresh")
self._log.debug(f"Refreshing {self.coin_name()} wallet")
rv = self.rpc_wallet( rv = self.rpc_wallet(
"get_transfers", "get_transfers",
{"in": True, "out": True, "pending": True, "failed": True}, {"in": True, "out": True, "pending": True, "failed": True},
@@ -711,6 +723,8 @@ class XMRInterface(CoinInterface):
def getSpendableBalance(self) -> int: def getSpendableBalance(self) -> int:
with self._mx_wallet: with self._mx_wallet:
self.openWallet(self._wallet_filename) self.openWallet(self._wallet_filename)
self.rpc_wallet("refresh")
self._log.debug(f"Refreshing {self.coin_name()} wallet")
balance_info = self.rpc_wallet("get_balance") balance_info = self.rpc_wallet("get_balance")
return balance_info["unlocked_balance"] return balance_info["unlocked_balance"]