forked from LBRYCommunity/lbry-sdk
add and test takeover info on resolve
This commit is contained in:
parent
1a5292aaf4
commit
18b25f5146
2 changed files with 15 additions and 2 deletions
|
@ -192,8 +192,8 @@ class Outputs:
|
||||||
if txo.meta['canonical_url'] is not None:
|
if txo.meta['canonical_url'] is not None:
|
||||||
txo_message.claim.canonical_url = txo.meta['canonical_url']
|
txo_message.claim.canonical_url = txo.meta['canonical_url']
|
||||||
txo_message.claim.is_controlling = bool(txo.meta['takeover_height'])
|
txo_message.claim.is_controlling = bool(txo.meta['takeover_height'])
|
||||||
#if txo['last_take_over_height'] is not None:
|
if txo_message.claim.is_controlling:
|
||||||
# txo_message.claim.take_over_height = txo['last_take_over_height']
|
txo_message.claim.take_over_height = txo.meta['takeover_height']
|
||||||
txo_message.claim.creation_height = txo.meta['creation_height']
|
txo_message.claim.creation_height = txo.meta['creation_height']
|
||||||
txo_message.claim.activation_height = txo.meta['activation_height']
|
txo_message.claim.activation_height = txo.meta['activation_height']
|
||||||
txo_message.claim.expiration_height = txo.meta['expiration_height']
|
txo_message.claim.expiration_height = txo.meta['expiration_height']
|
||||||
|
|
|
@ -933,6 +933,19 @@ class TestGeneralBlockchainSync(SyncingBlockchainTestCase):
|
||||||
claim = resolutions.txos[0].claim
|
claim = resolutions.txos[0].claim
|
||||||
self.assertEqual(claim.effective_amount, 1000000)
|
self.assertEqual(claim.effective_amount, 1000000)
|
||||||
self.assertEqual(claim.expiration_height, 602)
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue