From a7ea13c3cd83977aa30511b26180b8c5efcaf536 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 13 Jul 2022 09:45:36 -0700 Subject: [PATCH] remove unused _clear_database() functions (#12334) --- chia/wallet/cat_wallet/lineage_store.py | 5 ----- chia/wallet/key_val_store.py | 6 ------ chia/wallet/trading/trade_store.py | 5 ----- chia/wallet/wallet_action_store.py | 4 ---- chia/wallet/wallet_coin_store.py | 4 ---- chia/wallet/wallet_interested_store.py | 9 --------- chia/wallet/wallet_nft_store.py | 4 ---- chia/wallet/wallet_pool_store.py | 5 ----- chia/wallet/wallet_puzzle_store.py | 4 ---- chia/wallet/wallet_transaction_store.py | 4 ---- chia/wallet/wallet_user_store.py | 4 ---- 11 files changed, 54 deletions(-) diff --git a/chia/wallet/cat_wallet/lineage_store.py b/chia/wallet/cat_wallet/lineage_store.py index e627fbc1c233..5300fcb7acc9 100644 --- a/chia/wallet/cat_wallet/lineage_store.py +++ b/chia/wallet/cat_wallet/lineage_store.py @@ -29,11 +29,6 @@ class CATLineageStore: ) 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 with self.db_wrapper.write_db() as conn: cursor = await conn.execute( diff --git a/chia/wallet/key_val_store.py b/chia/wallet/key_val_store.py index 5f9c81c0b76d..a568a4112fcb 100644 --- a/chia/wallet/key_val_store.py +++ b/chia/wallet/key_val_store.py @@ -21,12 +21,6 @@ class KeyValStore: 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: """ Return bytes representation of stored object diff --git a/chia/wallet/trading/trade_store.py b/chia/wallet/trading/trade_store.py index 52525c4690a0..8020e4290f8b 100644 --- a/chia/wallet/trading/trade_store.py +++ b/chia/wallet/trading/trade_store.py @@ -95,11 +95,6 @@ class TradeStore: 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: """ Store TradeRecord into DB diff --git a/chia/wallet/wallet_action_store.py b/chia/wallet/wallet_action_store.py index 6a1a74637258..8e56da653da5 100644 --- a/chia/wallet/wallet_action_store.py +++ b/chia/wallet/wallet_action_store.py @@ -41,10 +41,6 @@ class WalletActionStore: await conn.execute("CREATE INDEX IF NOT EXISTS action_queue_wallet_type on action_queue(wallet_type)") 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]: """ Return a wallet action by id diff --git a/chia/wallet/wallet_coin_store.py b/chia/wallet/wallet_coin_store.py index a24a7c6693b1..c52107973fe7 100644 --- a/chia/wallet/wallet_coin_store.py +++ b/chia/wallet/wallet_coin_store.py @@ -53,10 +53,6 @@ class WalletCoinStore: 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]: """Return WalletCoinRecord(s) that have a coin name in the specified list""" if len(coin_names) == 0: diff --git a/chia/wallet/wallet_interested_store.py b/chia/wallet/wallet_interested_store.py index 80536694a2de..fce59f76fe6e 100644 --- a/chia/wallet/wallet_interested_store.py +++ b/chia/wallet/wallet_interested_store.py @@ -30,15 +30,6 @@ class WalletInterestedStore: 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 with self.db_wrapper.write_db() as conn: cursor = await conn.execute("SELECT coin_name FROM interested_coins") diff --git a/chia/wallet/wallet_nft_store.py b/chia/wallet/wallet_nft_store.py index 33b91ac6a56c..9686aec84350 100644 --- a/chia/wallet/wallet_nft_store.py +++ b/chia/wallet/wallet_nft_store.py @@ -43,10 +43,6 @@ class WalletNftStore: await conn.execute("CREATE INDEX IF NOT EXISTS nft_did_id on users_nfts(did_id)") 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 with self.db_wrapper.write_db() as conn: await (await conn.execute(f"DELETE FROM users_nfts where nft_id='{nft_id.hex()}'")).close() diff --git a/chia/wallet/wallet_pool_store.py b/chia/wallet/wallet_pool_store.py index c7a3f7bd7cb1..b2e485600aff 100644 --- a/chia/wallet/wallet_pool_store.py +++ b/chia/wallet/wallet_pool_store.py @@ -28,11 +28,6 @@ class WalletPoolStore: 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( self, wallet_id: int, diff --git a/chia/wallet/wallet_puzzle_store.py b/chia/wallet/wallet_puzzle_store.py index 9dfbc368b598..c7a4c743f8c4 100644 --- a/chia/wallet/wallet_puzzle_store.py +++ b/chia/wallet/wallet_puzzle_store.py @@ -70,10 +70,6 @@ class WalletPuzzleStore: # self.get_last_derivation_path_for_wallet_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: """ Insert many derivation paths into the database. diff --git a/chia/wallet/wallet_transaction_store.py b/chia/wallet/wallet_transaction_store.py index 9ae50f436167..24c001a73211 100644 --- a/chia/wallet/wallet_transaction_store.py +++ b/chia/wallet/wallet_transaction_store.py @@ -79,10 +79,6 @@ class WalletTransactionStore: self.last_wallet_tx_resend_time = int(time.time()) 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: """ Store TransactionRecord in DB and Cache. diff --git a/chia/wallet/wallet_user_store.py b/chia/wallet/wallet_user_store.py index 5de93d812a2d..a45a2990deab 100644 --- a/chia/wallet/wallet_user_store.py +++ b/chia/wallet/wallet_user_store.py @@ -44,10 +44,6 @@ class WalletUserStore: if len(all_wallets) == 0: 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( self, name: str,