diff --git a/lbry/schema/result.py b/lbry/schema/result.py index 48f43a1a9..87a165411 100644 --- a/lbry/schema/result.py +++ b/lbry/schema/result.py @@ -192,8 +192,8 @@ class Outputs: if txo.meta['canonical_url'] is not None: txo_message.claim.canonical_url = txo.meta['canonical_url'] txo_message.claim.is_controlling = bool(txo.meta['takeover_height']) - #if txo['last_take_over_height'] is not None: - # txo_message.claim.take_over_height = txo['last_take_over_height'] + if txo_message.claim.is_controlling: + txo_message.claim.take_over_height = txo.meta['takeover_height'] txo_message.claim.creation_height = txo.meta['creation_height'] txo_message.claim.activation_height = txo.meta['activation_height'] txo_message.claim.expiration_height = txo.meta['expiration_height'] diff --git a/tests/integration/blockchain/test_blockchain.py b/tests/integration/blockchain/test_blockchain.py index f23e7211b..c2f9b6ebd 100644 --- a/tests/integration/blockchain/test_blockchain.py +++ b/tests/integration/blockchain/test_blockchain.py @@ -933,6 +933,19 @@ class TestGeneralBlockchainSync(SyncingBlockchainTestCase): claim = resolutions.txos[0].claim self.assertEqual(claim.effective_amount, 1000000) self.assertEqual(claim.expiration_height, 602) + self.assertEqual(claim.take_over_height, 102) + self.assertTrue(claim.is_controlling) + # takeover + await self.create_claim(claim_id_startswith='ad', sign=chan_ab, amount='1.1') + await self.generate(1) + resolutions = Outputs.from_base64(await self.db.protobuf_resolve(["@foo#ab/foo#cd"])) + claim = resolutions.txos[0].claim + self.assertEqual(claim.take_over_height, 0) + self.assertFalse(claim.is_controlling) + resolutions = Outputs.from_base64(await self.db.protobuf_resolve(["@foo#ab/foo#ad"])) + claim = resolutions.txos[0].claim + self.assertEqual(claim.take_over_height, 103) + self.assertTrue(claim.is_controlling)