mirror of
https://github.com/basicswap/basicswap.git
synced 2024-12-22 11:39:34 +00:00
This commit is contained in:
parent
bd571702cb
commit
01f6a1d877
2 changed files with 17 additions and 10 deletions
|
@ -6767,9 +6767,9 @@ class BasicSwap(BaseApp):
|
||||||
cursor = self.openDB()
|
cursor = self.openDB()
|
||||||
|
|
||||||
query = "SELECT action_type, linked_id FROM actions WHERE active_ind = 1 AND trigger_at <= :now"
|
query = "SELECT action_type, linked_id FROM actions WHERE active_ind = 1 AND trigger_at <= :now"
|
||||||
q = cursor.execute(query, {"now": now})
|
rows = cursor.execute(query, {"now": now}).fetchall()
|
||||||
|
|
||||||
for row in q:
|
for row in rows:
|
||||||
action_type, linked_id = row
|
action_type, linked_id = row
|
||||||
accepting_bid: bool = False
|
accepting_bid: bool = False
|
||||||
try:
|
try:
|
||||||
|
@ -6801,7 +6801,7 @@ class BasicSwap(BaseApp):
|
||||||
accepting_bid = True
|
accepting_bid = True
|
||||||
self.acceptADSReverseBid(linked_id, cursor)
|
self.acceptADSReverseBid(linked_id, cursor)
|
||||||
else:
|
else:
|
||||||
self.log.warning("Unknown event type: %d", action_type)
|
self.log.warning(f"Unknown event type: {action_type}")
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
err_msg = f"checkQueuedActions failed: {ex}"
|
err_msg = f"checkQueuedActions failed: {ex}"
|
||||||
self.logException(err_msg)
|
self.logException(err_msg)
|
||||||
|
@ -7059,7 +7059,7 @@ class BasicSwap(BaseApp):
|
||||||
rv = cursor.execute(
|
rv = cursor.execute(
|
||||||
query_str,
|
query_str,
|
||||||
{"addr": msg["to"], "use_type": int(AddressTypes.RECV_OFFER)},
|
{"addr": msg["to"], "use_type": int(AddressTypes.RECV_OFFER)},
|
||||||
)[0]
|
).fetchone()
|
||||||
if rv[0] < 1:
|
if rv[0] < 1:
|
||||||
raise ValueError("Offer received on incorrect address")
|
raise ValueError("Offer received on incorrect address")
|
||||||
|
|
||||||
|
@ -10363,18 +10363,20 @@ class BasicSwap(BaseApp):
|
||||||
|
|
||||||
# Ensure the latest addresses are displayed
|
# Ensure the latest addresses are displayed
|
||||||
coin_name: str = chainparams[coin_id]["name"]
|
coin_name: str = chainparams[coin_id]["name"]
|
||||||
q = cursor.execute(
|
c2 = self.getNewDBCursor()
|
||||||
|
q2 = c2.execute(
|
||||||
"SELECT key, value FROM kv_string WHERE key = ? OR key = ?",
|
"SELECT key, value FROM kv_string WHERE key = ? OR key = ?",
|
||||||
(f"receive_addr_{coin_name}", f"stealth_addr_{coin_name}"),
|
(f"receive_addr_{coin_name}", f"stealth_addr_{coin_name}"),
|
||||||
)
|
)
|
||||||
for row in q:
|
for row2 in q2:
|
||||||
if row[0].startswith("stealth"):
|
if row2[0].startswith("stealth"):
|
||||||
if coin_id == Coins.LTC:
|
if coin_id == Coins.LTC:
|
||||||
wallet_data["mweb_address"] = row[1]
|
wallet_data["mweb_address"] = row2[1]
|
||||||
else:
|
else:
|
||||||
wallet_data["stealth_address"] = row[1]
|
wallet_data["stealth_address"] = row2[1]
|
||||||
else:
|
else:
|
||||||
wallet_data["deposit_address"] = row[1]
|
wallet_data["deposit_address"] = row2[1]
|
||||||
|
c2.close()
|
||||||
|
|
||||||
if coin_id in rv:
|
if coin_id in rv:
|
||||||
rv[coin_id].update(wallet_data)
|
rv[coin_id].update(wallet_data)
|
||||||
|
|
|
@ -737,6 +737,10 @@ class DBMethods:
|
||||||
self._db_con = sqlite3.connect(self.sqlite_file)
|
self._db_con = sqlite3.connect(self.sqlite_file)
|
||||||
return self._db_con.cursor()
|
return self._db_con.cursor()
|
||||||
|
|
||||||
|
def getNewDBCursor(self):
|
||||||
|
assert self.mxDB.locked()
|
||||||
|
return self._db_con.cursor()
|
||||||
|
|
||||||
def commitDB(self):
|
def commitDB(self):
|
||||||
assert self.mxDB.locked()
|
assert self.mxDB.locked()
|
||||||
self._db_con.commit()
|
self._db_con.commit()
|
||||||
|
@ -751,6 +755,7 @@ class DBMethods:
|
||||||
if commit:
|
if commit:
|
||||||
self._db_con.commit()
|
self._db_con.commit()
|
||||||
|
|
||||||
|
cursor.close()
|
||||||
self._db_con.close()
|
self._db_con.close()
|
||||||
self.mxDB.release()
|
self.mxDB.release()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue