depth -> confirmations

This commit is contained in:
Victor Shyba 2019-04-29 00:03:15 -03:00 committed by Lex Berezhny
parent ccd2023d37
commit 30b113d64a
4 changed files with 8 additions and 5 deletions

View file

@ -842,7 +842,8 @@ class Daemon(metaclass=JSONRPCServerType):
'claim_sequence': (int) claim sequence number (or -1 if unknown), 'claim_sequence': (int) claim sequence number (or -1 if unknown),
'decoded_claim': (bool) whether or not the claim value was decoded, 'decoded_claim': (bool) whether or not the claim value was decoded,
'height': (int) claim height, 'height': (int) claim height,
'depth': (int) claim depth, 'confirmations': (int) claim depth,
'timestamp': (int) timestamp of the block that included this claim tx,
'has_signature': (bool) included if decoded_claim 'has_signature': (bool) included if decoded_claim
'name': (str) claim name, 'name': (str) claim name,
'permanent_url': (str) permanent url of the certificate claim, 'permanent_url': (str) permanent url of the certificate claim,

View file

@ -154,6 +154,8 @@ class Resolver:
claim_result = _decode_claim_result(claim_result) claim_result = _decode_claim_result(claim_result)
if claim_result.get('height'): if claim_result.get('height'):
claim_result['timestamp'] = self.ledger.headers[claim_result['height']]['timestamp'] claim_result['timestamp'] = self.ledger.headers[claim_result['height']]['timestamp']
if claim_result.get('depth'):
claim_result['confirmations'] = claim_result.pop('depth')
if claim_result['value']: if claim_result['value']:
claim_result['has_signature'] = False claim_result['has_signature'] = False
@ -298,7 +300,7 @@ def _verify_proof(name, claim_trie_root, result, ledger):
'amount': output.amount, 'amount': output.amount,
'effective_amount': output.amount + support_amount, 'effective_amount': output.amount + support_amount,
'height': result['height'], 'height': result['height'],
'depth': result['depth'], 'confirmations': result['depth'],
'claim_sequence': result['claim_sequence'], 'claim_sequence': result['claim_sequence'],
'address': output.get_address(ledger), 'address': output.get_address(ledger),
'valid_at_height': result['valid_at_height'], 'valid_at_height': result['valid_at_height'],

View file

@ -73,9 +73,9 @@ class ResolveCommand(CommandTestCase):
self.assertEqual(claim['certificate']['name'], '@abc') self.assertEqual(claim['certificate']['name'], '@abc')
self.assertEqual(claim['claims_in_channel'], 0) self.assertEqual(claim['claims_in_channel'], 0)
# resolve has correct depth # resolve has correct confirmations
tx_details = await self.blockchain.get_raw_transaction(claim['claim']['txid']) tx_details = await self.blockchain.get_raw_transaction(claim['claim']['txid'])
self.assertEqual(claim['claim']['depth'], json.loads(tx_details)['confirmations']) self.assertEqual(claim['claim']['confirmations'], json.loads(tx_details)['confirmations'])
# resolve handles invalid data # resolve handles invalid data
txid = await self.blockchain_claim_name( txid = await self.blockchain_claim_name(

View file

@ -45,7 +45,7 @@ def get_mock_wallet(sd_hash, storage, balance=10.0, fee=None):
"claim_id": "c49566d631226492317d06ad7fdbe1ed32925124", "claim_id": "c49566d631226492317d06ad7fdbe1ed32925124",
"claim_sequence": 1, "claim_sequence": 1,
"decoded_claim": True, "decoded_claim": True,
"depth": 1057, "confirmations": 1057,
"effective_amount": "0.1", "effective_amount": "0.1",
"has_signature": False, "has_signature": False,
"height": 514081, "height": 514081,