add expiration_height

This commit is contained in:
Victor Shyba 2020-09-23 00:20:08 -03:00 committed by Lex Berezhny
parent 39ba2a8b7f
commit 1a5292aaf4
4 changed files with 12 additions and 2 deletions

View file

@ -75,6 +75,7 @@ BASE_SELECT_CLAIM_COLUMNS = BASE_SELECT_TXO_COLUMNS + [
Claim.c.activation_height, Claim.c.activation_height,
Claim.c.takeover_height, Claim.c.takeover_height,
Claim.c.creation_height, Claim.c.creation_height,
Claim.c.expiration_height,
Claim.c.is_controlling, Claim.c.is_controlling,
Claim.c.channel_hash, Claim.c.channel_hash,
Claim.c.reposted_count, Claim.c.reposted_count,

View file

@ -372,7 +372,7 @@ META_ATTRS = (
'activation_height', 'takeover_height', 'creation_height', 'staked_amount', 'activation_height', 'takeover_height', 'creation_height', 'staked_amount',
'short_url', 'canonical_url', 'staked_support_amount', 'staked_support_count', 'short_url', 'canonical_url', 'staked_support_amount', 'staked_support_count',
'signed_claim_count', 'signed_support_count', 'is_signature_valid', 'signed_claim_count', 'signed_support_count', 'is_signature_valid',
'reposted_count', 'reposted_count', 'expiration_height'
) )

View file

@ -196,7 +196,7 @@ class Outputs:
# txo_message.claim.take_over_height = txo['last_take_over_height'] # txo_message.claim.take_over_height = txo['last_take_over_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['expiration_height'] txo_message.claim.expiration_height = txo.meta['expiration_height']
if txo.meta['signed_claim_count'] is not None: if txo.meta['signed_claim_count'] is not None:
txo_message.claim.claims_in_channel = txo.meta['signed_claim_count'] txo_message.claim.claims_in_channel = txo.meta['signed_claim_count']
txo_message.claim.effective_amount = txo.meta['staked_amount'] txo_message.claim.effective_amount = txo.meta['staked_amount']

View file

@ -924,6 +924,15 @@ class TestGeneralBlockchainSync(SyncingBlockchainTestCase):
results = await self.db.search_claims(effective_amount=42000000, amount_order=1, order_by=["effective_amount"]) results = await self.db.search_claims(effective_amount=42000000, amount_order=1, order_by=["effective_amount"])
self.assertEqual(claim.claim_id, results[0].claim_id) self.assertEqual(claim.claim_id, results[0].claim_id)
async def test_meta_fields_are_translated_to_protobuf(self):
chan_ab = await self.get_claim(
await self.create_claim(claim_id_startswith='ab', is_channel=True))
await self.create_claim(claim_id_startswith='cd', sign=chan_ab)
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.effective_amount, 1000000)
self.assertEqual(claim.expiration_height, 602)