From afa710dcb5b2f9b2cfcec70331d95a22beb5a842 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Fri, 1 Oct 2021 13:52:33 -0400 Subject: [PATCH] fix and add test for abandoning a controlling in the same block a new claim is made --- lbry/wallet/server/block_processor.py | 2 +- tests/integration/blockchain/test_resolve_command.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lbry/wallet/server/block_processor.py b/lbry/wallet/server/block_processor.py index fb2b1eda8..893eb540c 100644 --- a/lbry/wallet/server/block_processor.py +++ b/lbry/wallet/server/block_processor.py @@ -784,7 +784,7 @@ class BlockProcessor: nothing_is_controlling = not controlling staged_is_controlling = False if not controlling else claim_hash == controlling.claim_hash controlling_is_abandoned = False if not controlling else \ - controlling.claim_hash in names_with_abandoned_or_updated_controlling_claims + name in names_with_abandoned_or_updated_controlling_claims if nothing_is_controlling or staged_is_controlling or controlling_is_abandoned: delay = 0 diff --git a/tests/integration/blockchain/test_resolve_command.py b/tests/integration/blockchain/test_resolve_command.py index ed9d9967d..04416e117 100644 --- a/tests/integration/blockchain/test_resolve_command.py +++ b/tests/integration/blockchain/test_resolve_command.py @@ -1379,6 +1379,17 @@ class ResolveClaimTakeovers(BaseResolveTestCase): len((await self.conductor.spv_node.server.bp.db.search_index.search(claim_name=name))[0]), 2 ) + async def test_abandon_controlling_same_block_as_new_claim(self): + name = 'derp' + + first_claim_id = (await self.stream_create(name, '0.1'))['outputs'][0]['claim_id'] + await self.generate(64) + await self.assertNameState(271, name, first_claim_id, last_takeover_height=207, non_winning_claims=[]) + + await self.daemon.jsonrpc_txo_spend(type='stream', claim_id=first_claim_id) + second_claim_id = (await self.stream_create(name, '0.1', allow_duplicate_name=True))['outputs'][0]['claim_id'] + await self.assertNameState(272, name, second_claim_id, last_takeover_height=272, non_winning_claims=[]) + async def test_trending(self): async def get_trending_score(claim_id): return (await self.conductor.spv_node.server.bp.db.search_index.search(