diff --git a/lbry/wallet/server/block_processor.py b/lbry/wallet/server/block_processor.py index ad4cc0b33..b76181063 100644 --- a/lbry/wallet/server/block_processor.py +++ b/lbry/wallet/server/block_processor.py @@ -1,4 +1,3 @@ -import os import time import asyncio from struct import pack, unpack @@ -287,9 +286,6 @@ class BlockProcessor: await self.run_in_thread_with_lock(flush_backup) last -= len(raw_blocks) - if self.sql: - await self.run_in_thread_with_lock(self.db.sql.delete_claims_above_height, self.height) - await self.db.search_index.delete_above_height(self.height) await self.prefetcher.reset_height(self.height) self.reorg_count_metric.inc() except: diff --git a/lbry/wallet/server/db/writer.py b/lbry/wallet/server/db/writer.py index 406ebd7fa..d7a0809ed 100644 --- a/lbry/wallet/server/db/writer.py +++ b/lbry/wallet/server/db/writer.py @@ -439,7 +439,7 @@ class SQLDB: claims = self._upsertable_claims(txos, header) if claims: self.executemany(""" - INSERT OR IGNORE INTO claim ( + INSERT OR REPLACE INTO claim ( claim_hash, claim_id, claim_name, normalized, txo_hash, tx_position, amount, claim_type, media_type, stream_type, timestamp, creation_timestamp, has_source, fee_currency, fee_amount, title, description, author, duration, height, reposted_claim_hash, diff --git a/tests/integration/blockchain/test_blockchain_reorganization.py b/tests/integration/blockchain/test_blockchain_reorganization.py index 5ae8786be..3f7a1f0b1 100644 --- a/tests/integration/blockchain/test_blockchain_reorganization.py +++ b/tests/integration/blockchain/test_blockchain_reorganization.py @@ -114,15 +114,6 @@ class BlockchainReorganizationTests(CommandTestCase): client_reorg_block_hash = (await self.ledger.headers.hash(208)).decode() self.assertEqual(client_reorg_block_hash, reorg_block_hash) - # verify the dropped claim is no longer returned by claim search - txos, _, _, _ = await self.ledger.claim_search([], name='hovercraft') - self.assertListEqual(txos, []) - - # verify the claim published a block earlier wasn't also reverted - txos, _, _, _ = await self.ledger.claim_search([], name='still-valid') - self.assertEqual(1, len(txos)) - self.assertEqual(207, txos[0].tx_ref.height) - # broadcast the claim in a different block new_txid = await self.blockchain.sendrawtransaction(hexlify(broadcast_tx.raw).decode()) self.assertEqual(broadcast_tx.id, new_txid)