mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-11-10 12:29:49 +03:00
remove unused _clear_database() functions (#12334)
This commit is contained in:
parent
8f54fd292a
commit
a7ea13c3cd
@ -29,11 +29,6 @@ class CATLineageStore:
|
|||||||
)
|
)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
async def _clear_database(self):
|
|
||||||
async with self.db_wrapper.write_db() as conn:
|
|
||||||
cursor = await conn.execute(f"DELETE FROM {self.table_name}")
|
|
||||||
await cursor.close()
|
|
||||||
|
|
||||||
async def add_lineage_proof(self, coin_id: bytes32, lineage: LineageProof) -> None:
|
async def add_lineage_proof(self, coin_id: bytes32, lineage: LineageProof) -> None:
|
||||||
async with self.db_wrapper.write_db() as conn:
|
async with self.db_wrapper.write_db() as conn:
|
||||||
cursor = await conn.execute(
|
cursor = await conn.execute(
|
||||||
|
@ -21,12 +21,6 @@ class KeyValStore:
|
|||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
async def _clear_database(self):
|
|
||||||
async with self.db_wrapper.write_db() as conn:
|
|
||||||
cursor = await conn.execute("DELETE FROM key_val_store")
|
|
||||||
await cursor.close()
|
|
||||||
await conn.commit()
|
|
||||||
|
|
||||||
async def get_object(self, key: str, object_type: Any) -> Any:
|
async def get_object(self, key: str, object_type: Any) -> Any:
|
||||||
"""
|
"""
|
||||||
Return bytes representation of stored object
|
Return bytes representation of stored object
|
||||||
|
@ -95,11 +95,6 @@ class TradeStore:
|
|||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
async def _clear_database(self):
|
|
||||||
async with self.db_wrapper.write_db() as conn:
|
|
||||||
cursor = await conn.execute("DELETE FROM trade_records")
|
|
||||||
await cursor.close()
|
|
||||||
|
|
||||||
async def add_trade_record(self, record: TradeRecord) -> None:
|
async def add_trade_record(self, record: TradeRecord) -> None:
|
||||||
"""
|
"""
|
||||||
Store TradeRecord into DB
|
Store TradeRecord into DB
|
||||||
|
@ -41,10 +41,6 @@ class WalletActionStore:
|
|||||||
await conn.execute("CREATE INDEX IF NOT EXISTS action_queue_wallet_type on action_queue(wallet_type)")
|
await conn.execute("CREATE INDEX IF NOT EXISTS action_queue_wallet_type on action_queue(wallet_type)")
|
||||||
return self
|
return self
|
||||||
|
|
||||||
async def _clear_database(self):
|
|
||||||
async with self.db_wrapper.write_db() as conn:
|
|
||||||
await (await conn.execute("DELETE FROM action_queue")).close()
|
|
||||||
|
|
||||||
async def get_wallet_action(self, id: int) -> Optional[WalletAction]:
|
async def get_wallet_action(self, id: int) -> Optional[WalletAction]:
|
||||||
"""
|
"""
|
||||||
Return a wallet action by id
|
Return a wallet action by id
|
||||||
|
@ -53,10 +53,6 @@ class WalletCoinStore:
|
|||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
async def _clear_database(self):
|
|
||||||
async with self.db_wrapper.write_db() as conn:
|
|
||||||
await (await conn.execute("DELETE FROM coin_record")).close()
|
|
||||||
|
|
||||||
async def get_multiple_coin_records(self, coin_names: List[bytes32]) -> List[WalletCoinRecord]:
|
async def get_multiple_coin_records(self, coin_names: List[bytes32]) -> List[WalletCoinRecord]:
|
||||||
"""Return WalletCoinRecord(s) that have a coin name in the specified list"""
|
"""Return WalletCoinRecord(s) that have a coin name in the specified list"""
|
||||||
if len(coin_names) == 0:
|
if len(coin_names) == 0:
|
||||||
|
@ -30,15 +30,6 @@ class WalletInterestedStore:
|
|||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
async def _clear_database(self):
|
|
||||||
async with self.db_wrapper.write_db() as conn:
|
|
||||||
cursor = await conn.execute("DELETE FROM interested_puzzle_hashes")
|
|
||||||
await cursor.close()
|
|
||||||
cursor = await conn.execute("DELETE FROM interested_coins")
|
|
||||||
await cursor.close()
|
|
||||||
cursor = await conn.execute("DELETE FROM unacknowledged_asset_tokens")
|
|
||||||
await cursor.close()
|
|
||||||
|
|
||||||
async def get_interested_coin_ids(self) -> List[bytes32]:
|
async def get_interested_coin_ids(self) -> List[bytes32]:
|
||||||
async with self.db_wrapper.write_db() as conn:
|
async with self.db_wrapper.write_db() as conn:
|
||||||
cursor = await conn.execute("SELECT coin_name FROM interested_coins")
|
cursor = await conn.execute("SELECT coin_name FROM interested_coins")
|
||||||
|
@ -43,10 +43,6 @@ class WalletNftStore:
|
|||||||
await conn.execute("CREATE INDEX IF NOT EXISTS nft_did_id on users_nfts(did_id)")
|
await conn.execute("CREATE INDEX IF NOT EXISTS nft_did_id on users_nfts(did_id)")
|
||||||
return self
|
return self
|
||||||
|
|
||||||
async def _clear_database(self) -> None:
|
|
||||||
async with self.db_wrapper.write_db() as conn:
|
|
||||||
await (await conn.execute("DELETE FROM users_nfts")).close()
|
|
||||||
|
|
||||||
async def delete_nft(self, nft_id: bytes32) -> None:
|
async def delete_nft(self, nft_id: bytes32) -> None:
|
||||||
async with self.db_wrapper.write_db() as conn:
|
async with self.db_wrapper.write_db() as conn:
|
||||||
await (await conn.execute(f"DELETE FROM users_nfts where nft_id='{nft_id.hex()}'")).close()
|
await (await conn.execute(f"DELETE FROM users_nfts where nft_id='{nft_id.hex()}'")).close()
|
||||||
|
@ -28,11 +28,6 @@ class WalletPoolStore:
|
|||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
async def _clear_database(self):
|
|
||||||
async with self.db_wrapper.write_db() as conn:
|
|
||||||
cursor = await conn.execute("DELETE FROM interested_coins")
|
|
||||||
await cursor.close()
|
|
||||||
|
|
||||||
async def add_spend(
|
async def add_spend(
|
||||||
self,
|
self,
|
||||||
wallet_id: int,
|
wallet_id: int,
|
||||||
|
@ -70,10 +70,6 @@ class WalletPuzzleStore:
|
|||||||
# self.get_last_derivation_path_for_wallet_cache = LRUCache(100)
|
# self.get_last_derivation_path_for_wallet_cache = LRUCache(100)
|
||||||
self.wallet_info_for_ph_cache = LRUCache(100)
|
self.wallet_info_for_ph_cache = LRUCache(100)
|
||||||
|
|
||||||
async def _clear_database(self):
|
|
||||||
async with self.db_wrapper.write_db() as conn:
|
|
||||||
await (await conn.execute("DELETE FROM derivation_paths")).close()
|
|
||||||
|
|
||||||
async def add_derivation_paths(self, records: List[DerivationRecord]) -> None:
|
async def add_derivation_paths(self, records: List[DerivationRecord]) -> None:
|
||||||
"""
|
"""
|
||||||
Insert many derivation paths into the database.
|
Insert many derivation paths into the database.
|
||||||
|
@ -79,10 +79,6 @@ class WalletTransactionStore:
|
|||||||
self.last_wallet_tx_resend_time = int(time.time())
|
self.last_wallet_tx_resend_time = int(time.time())
|
||||||
return self
|
return self
|
||||||
|
|
||||||
async def _clear_database(self):
|
|
||||||
async with self.db_wrapper.write_db() as conn:
|
|
||||||
await (await conn.execute("DELETE FROM transaction_record")).close()
|
|
||||||
|
|
||||||
async def add_transaction_record(self, record: TransactionRecord) -> None:
|
async def add_transaction_record(self, record: TransactionRecord) -> None:
|
||||||
"""
|
"""
|
||||||
Store TransactionRecord in DB and Cache.
|
Store TransactionRecord in DB and Cache.
|
||||||
|
@ -44,10 +44,6 @@ class WalletUserStore:
|
|||||||
if len(all_wallets) == 0:
|
if len(all_wallets) == 0:
|
||||||
await self.create_wallet("Chia Wallet", WalletType.STANDARD_WALLET, "")
|
await self.create_wallet("Chia Wallet", WalletType.STANDARD_WALLET, "")
|
||||||
|
|
||||||
async def _clear_database(self):
|
|
||||||
async with self.db_wrapper.write_db() as conn:
|
|
||||||
await (await conn.execute("DELETE FROM users_wallets")).close()
|
|
||||||
|
|
||||||
async def create_wallet(
|
async def create_wallet(
|
||||||
self,
|
self,
|
||||||
name: str,
|
name: str,
|
||||||
|
Loading…
Reference in New Issue
Block a user