mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-11-10 12:29:49 +03:00
Update locks
(cherry picked from commit 2c0c973b09f83a97ac107c1b4c5dbdb99a95ca15)
This commit is contained in:
parent
f96ae11094
commit
51ce66d7b2
@ -114,6 +114,7 @@ class FullNodeStore:
|
||||
await self.db.close()
|
||||
|
||||
async def _clear_database(self):
|
||||
async with self.lock:
|
||||
await self.db.execute("DELETE FROM blocks")
|
||||
await self.db.execute("DELETE FROM potential_blocks")
|
||||
await self.db.execute("DELETE FROM headers")
|
||||
|
@ -1046,12 +1046,14 @@ class WalletStateManager:
|
||||
self.tx_pending_changed()
|
||||
|
||||
async def close_all_stores(self):
|
||||
async with self.lock:
|
||||
await self.wallet_store.close()
|
||||
await self.tx_store.close()
|
||||
await self.puzzle_store.close()
|
||||
await self.user_store.close()
|
||||
|
||||
async def clear_all_stores(self):
|
||||
async with self.lock:
|
||||
await self.wallet_store._clear_database()
|
||||
await self.tx_store._clear_database()
|
||||
await self.puzzle_store._clear_database()
|
||||
|
@ -17,7 +17,6 @@ class WalletStore:
|
||||
|
||||
db_connection: aiosqlite.Connection
|
||||
# Whether or not we are syncing
|
||||
lock: asyncio.Lock
|
||||
coin_record_cache: Dict[str, WalletCoinRecord]
|
||||
cache_size: uint32
|
||||
|
||||
@ -74,8 +73,6 @@ class WalletStore:
|
||||
)
|
||||
|
||||
await self.db_connection.commit()
|
||||
# Lock
|
||||
self.lock = asyncio.Lock() # external
|
||||
self.coin_record_cache = dict()
|
||||
return self
|
||||
|
||||
|
@ -15,7 +15,6 @@ class WalletTransactionStore:
|
||||
"""
|
||||
|
||||
db_connection: aiosqlite.Connection
|
||||
lock: asyncio.Lock
|
||||
cache_size: uint32
|
||||
tx_record_cache: Dict[bytes32, TransactionRecord]
|
||||
|
||||
@ -77,8 +76,6 @@ class WalletTransactionStore:
|
||||
)
|
||||
|
||||
await self.db_connection.commit()
|
||||
# Lock
|
||||
self.lock = asyncio.Lock() # external
|
||||
self.tx_record_cache = dict()
|
||||
return self
|
||||
|
||||
|
@ -14,7 +14,6 @@ class WalletUserStore:
|
||||
"""
|
||||
|
||||
db_connection: aiosqlite.Connection
|
||||
lock: asyncio.Lock
|
||||
cache_size: uint32
|
||||
|
||||
@classmethod
|
||||
@ -46,8 +45,6 @@ class WalletUserStore:
|
||||
)
|
||||
|
||||
await self.db_connection.commit()
|
||||
# Lock
|
||||
self.lock = asyncio.Lock() # external
|
||||
await self.init_wallet()
|
||||
return self
|
||||
|
||||
|
@ -336,9 +336,7 @@ class WebSocketServer:
|
||||
"state": state,
|
||||
}
|
||||
if self.websocket is not None:
|
||||
# try:
|
||||
await self.websocket.send(format_response("state_changed", data))
|
||||
# except Conne
|
||||
|
||||
def state_changed_callback(self, state: str):
|
||||
if self.websocket is None:
|
||||
|
Loading…
Reference in New Issue
Block a user