test_early_takeover_abandoned_controlling_support

This commit is contained in:
Jack Robison 2021-05-25 18:42:39 -04:00 committed by Victor Shyba
parent 2ba044ee4e
commit 73da5a35b8

View file

@ -455,6 +455,32 @@ class ResolveClaimTakeovers(BaseResolveTestCase):
await self.generate(1) await self.generate(1)
await self.assertMatchClaimIsWinning(name, third_claim_id) await self.assertMatchClaimIsWinning(name, third_claim_id)
async def test_early_takeover_abandoned_controlling_support(self):
name = 'derp'
# block 207
first_claim_id = (await self.stream_create(name, '0.1', allow_duplicate_name=True))['outputs'][0][
'claim_id']
tx = await self.daemon.jsonrpc_support_create(first_claim_id, '0.2')
await self.ledger.wait(tx)
await self.assertMatchClaimIsWinning(name, first_claim_id)
await self.generate(96)
# block 304, activates at 307
second_claim_id = (await self.stream_create(name, '0.2', allow_duplicate_name=True))['outputs'][0][
'claim_id']
# block 305, activates at 308 (but gets triggered early by the takeover by the second claim)
third_claim_id = (await self.stream_create(name, '0.3', allow_duplicate_name=True))['outputs'][0][
'claim_id']
self.assertNotEqual(first_claim_id, second_claim_id)
# takeover should not have happened yet
await self.assertMatchClaimIsWinning(name, first_claim_id)
await self.generate(1)
await self.assertMatchClaimIsWinning(name, first_claim_id)
await self.daemon.jsonrpc_txo_spend(type='support', txid=tx.id)
await self.generate(1)
await self.assertMatchClaimIsWinning(name, third_claim_id)
await self.generate(1)
await self.assertMatchClaimIsWinning(name, third_claim_id)
async def test_block_takeover_with_delay_1_support(self): async def test_block_takeover_with_delay_1_support(self):
name = 'derp' name = 'derp'
# initially claim the name # initially claim the name