From 30b113d64a3b81a7c7f181c28cda1a7e1e187913 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Mon, 29 Apr 2019 00:03:15 -0300 Subject: [PATCH] depth -> confirmations --- lbrynet/extras/daemon/Daemon.py | 3 ++- lbrynet/wallet/resolve.py | 4 +++- tests/integration/test_resolve_command.py | 4 ++-- tests/unit/stream/test_stream_manager.py | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lbrynet/extras/daemon/Daemon.py b/lbrynet/extras/daemon/Daemon.py index d6f72662f..af3f5844a 100644 --- a/lbrynet/extras/daemon/Daemon.py +++ b/lbrynet/extras/daemon/Daemon.py @@ -842,7 +842,8 @@ class Daemon(metaclass=JSONRPCServerType): 'claim_sequence': (int) claim sequence number (or -1 if unknown), 'decoded_claim': (bool) whether or not the claim value was decoded, '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 'name': (str) claim name, 'permanent_url': (str) permanent url of the certificate claim, diff --git a/lbrynet/wallet/resolve.py b/lbrynet/wallet/resolve.py index e5d576a7e..a17fbfb59 100644 --- a/lbrynet/wallet/resolve.py +++ b/lbrynet/wallet/resolve.py @@ -154,6 +154,8 @@ class Resolver: claim_result = _decode_claim_result(claim_result) if claim_result.get('height'): 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']: claim_result['has_signature'] = False @@ -298,7 +300,7 @@ def _verify_proof(name, claim_trie_root, result, ledger): 'amount': output.amount, 'effective_amount': output.amount + support_amount, 'height': result['height'], - 'depth': result['depth'], + 'confirmations': result['depth'], 'claim_sequence': result['claim_sequence'], 'address': output.get_address(ledger), 'valid_at_height': result['valid_at_height'], diff --git a/tests/integration/test_resolve_command.py b/tests/integration/test_resolve_command.py index 71ae6c94b..947e89509 100644 --- a/tests/integration/test_resolve_command.py +++ b/tests/integration/test_resolve_command.py @@ -73,9 +73,9 @@ class ResolveCommand(CommandTestCase): self.assertEqual(claim['certificate']['name'], '@abc') 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']) - self.assertEqual(claim['claim']['depth'], json.loads(tx_details)['confirmations']) + self.assertEqual(claim['claim']['confirmations'], json.loads(tx_details)['confirmations']) # resolve handles invalid data txid = await self.blockchain_claim_name( diff --git a/tests/unit/stream/test_stream_manager.py b/tests/unit/stream/test_stream_manager.py index 9fd957df1..761154b42 100644 --- a/tests/unit/stream/test_stream_manager.py +++ b/tests/unit/stream/test_stream_manager.py @@ -45,7 +45,7 @@ def get_mock_wallet(sd_hash, storage, balance=10.0, fee=None): "claim_id": "c49566d631226492317d06ad7fdbe1ed32925124", "claim_sequence": 1, "decoded_claim": True, - "depth": 1057, + "confirmations": 1057, "effective_amount": "0.1", "has_signature": False, "height": 514081,