mirror of
https://github.com/basicswap/basicswap.git
synced 2026-04-29 11:12:12 +02:00
Fix: Waiting on Electrum Server + re-check the seed after error.
This commit is contained in:
+12
-5
@@ -1651,11 +1651,14 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
|
|||||||
for c in check_coins:
|
for c in check_coins:
|
||||||
ci = self.ci(c)
|
ci = self.ci(c)
|
||||||
if self._restrict_unknown_seed_wallets and not ci.knownWalletSeed():
|
if self._restrict_unknown_seed_wallets and not ci.knownWalletSeed():
|
||||||
raise ValueError(
|
if not ci._have_checked_seed:
|
||||||
'{} has an unexpected wallet seed and "restrict_unknown_seed_wallets" is enabled.'.format(
|
self.checkWalletSeed(c)
|
||||||
ci.coin_name()
|
if not ci.knownWalletSeed():
|
||||||
|
raise ValueError(
|
||||||
|
'{} has an unexpected wallet seed and "restrict_unknown_seed_wallets" is enabled.'.format(
|
||||||
|
ci.coin_name()
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
if self.coin_clients[c]["connection_type"] not in ("rpc", "electrum"):
|
if self.coin_clients[c]["connection_type"] not in ("rpc", "electrum"):
|
||||||
continue
|
continue
|
||||||
if c in (Coins.XMR, Coins.WOW):
|
if c in (Coins.XMR, Coins.WOW):
|
||||||
@@ -13896,7 +13899,11 @@ class BasicSwap(BaseApp, BSXNetwork, UIApp):
|
|||||||
"unconfirmed": ci.format_amount(
|
"unconfirmed": ci.format_amount(
|
||||||
walletinfo["unconfirmed_balance"], conv_int=True
|
walletinfo["unconfirmed_balance"], conv_int=True
|
||||||
),
|
),
|
||||||
"expected_seed": ci.knownWalletSeed(),
|
"expected_seed": (
|
||||||
|
ci.knownWalletSeed()
|
||||||
|
if ci._have_checked_seed
|
||||||
|
else self.checkWalletSeed(coin)
|
||||||
|
),
|
||||||
"encrypted": walletinfo["encrypted"],
|
"encrypted": walletinfo["encrypted"],
|
||||||
"locked": walletinfo["locked"],
|
"locked": walletinfo["locked"],
|
||||||
"connection_type": self.coin_clients[coin].get(
|
"connection_type": self.coin_clients[coin].get(
|
||||||
|
|||||||
@@ -257,6 +257,7 @@ class XMRInterface(CoinInterface):
|
|||||||
)
|
)
|
||||||
raise
|
raise
|
||||||
os.rename(walletpath, bkp_path)
|
os.rename(walletpath, bkp_path)
|
||||||
|
self._have_checked_seed = False
|
||||||
# Drop through to open_wallet
|
# Drop through to open_wallet
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|||||||
@@ -810,7 +810,9 @@ class ElectrumBackend(WalletBackend):
|
|||||||
|
|
||||||
now = time.time()
|
now = time.time()
|
||||||
stale_threshold = 300
|
stale_threshold = 300
|
||||||
is_synced = height > 0 and (now - height_time) < stale_threshold
|
last_activity = getattr(self._server, "_last_activity", 0)
|
||||||
|
most_recent = max(height_time, last_activity)
|
||||||
|
is_synced = height > 0 and (now - most_recent) < stale_threshold
|
||||||
return {
|
return {
|
||||||
"height": height,
|
"height": height,
|
||||||
"synced": is_synced,
|
"synced": is_synced,
|
||||||
|
|||||||
Reference in New Issue
Block a user