diff --git a/src/cutecoin/core/registry/identity.py b/src/cutecoin/core/registry/identity.py index 03d073dd56779756541fe6460e01a90b298a684d..30ab91f1b196cc903fa4abf8f7e9620fe681c5b0 100644 --- a/src/cutecoin/core/registry/identity.py +++ b/src/cutecoin/core/registry/identity.py @@ -18,12 +18,27 @@ from PyQt5.QtCore import QObject, pyqtSignal class LocalState(Enum): + """ + The local state describes how the identity exists locally : + COMPLETED means all its related datas (certifiers, certified...) + were succefully downloaded + PARTIAL means not all data are present locally + NOT_FOUND means it could not be found anywhere + """ NOT_FOUND = 0 PARTIAL = 1 COMPLETED = 2 class BlockchainState(Enum): + """ + The blockchain state describes how the identity + was found : + VALIDATED means it was found in the blockchain + BUFFERED means it was found via a lookup but not in the + blockchain + NOT_FOUND means it could not be found anywhere + """ NOT_FOUND = 0 BUFFERED = 1 VALIDATED = 2 diff --git a/src/cutecoin/core/transfer.py b/src/cutecoin/core/transfer.py index b0807af1c5ecf436e329950660e7f897bc4f9e91..e7ec95069395c3768a7e1edc5304901ea341aa8a 100644 --- a/src/cutecoin/core/transfer.py +++ b/src/cutecoin/core/transfer.py @@ -117,7 +117,7 @@ class Transfer(QObject): blockid = yield from community.blockid() block = yield from community.bma_access.future_request(qtbma.blockchain.Block, req_args={'number': blockid['number']}) - if block != qtbma.Blockchain.Block.null_value: + if block != qtbma.blockchain.Block.null_value: self._metadata['block'] = blockid['number'] self._metadata['time'] = block['medianTime'] diff --git a/src/cutecoin/core/txhistory.py b/src/cutecoin/core/txhistory.py index dfab7c97a549ae397019c39687f747e665144fd5..8c60a80bdd31bbe4eaf393cac83d3ed4bc6433c6 100644 --- a/src/cutecoin/core/txhistory.py +++ b/src/cutecoin/core/txhistory.py @@ -77,7 +77,7 @@ class TxHistory(): if o.pubkey != txdata['issuers'][0]] block_number = txdata['block_number'] - if block_number + self.app.preferences['data_validation'] >= current_block: + if block_number + self.app.preferences['data_validation'] >= current_block["number"]: state = Transfer.VALIDATED else: state = Transfer.VALIDATING @@ -118,7 +118,7 @@ class TxHistory(): # We check if the transaction correspond to one we sent # but not from this cutecoin Instance - if txdata['hash'] not in [t.metadata['hash'] for t in awaiting]: + if txdata['hash'] not in [t.hash for t in awaiting]: # If the wallet pubkey is in the issuers we sent this transaction if in_issuers: outputs = [o for o in tx_outputs @@ -141,14 +141,14 @@ class TxHistory(): amount += o.amount metadata['amount'] = amount - if txdata['hash'] not in [t['hash'] for t in awaiting]: + if txdata['hash'] not in [t.hash for t in awaiting]: transfer = Transfer.create_from_blockchain(txdata['hash'], state, metadata.copy()) received_list.append(transfer) return transfer else: - transfer = [t for t in awaiting if t.metadata['hash'] == txdata['hash']][0] + transfer = [t for t in awaiting if t.hash == txdata['hash']][0] transfer.check_registered(txdata['hash'], current_block, mediantime, self.app.preferences['data_validation']) return None @@ -208,7 +208,8 @@ class TxHistory(): parsed_block, current_block['number'])) else: - transfer = yield from self._parse_transaction(community, txdata, received_list, udid + txid) + transfer = yield from self._parse_transaction(community, txdata, received_list, + udid + txid, current_block) if transfer: new_transfers.append(transfer) diff --git a/src/cutecoin/models/identities.py b/src/cutecoin/models/identities.py index 7e32c77ce057d733d79efe9859aaf0daabd3742f..1a66f0f92b18518a5cb59bc0066a6992cbf0a690 100644 --- a/src/cutecoin/models/identities.py +++ b/src/cutecoin/models/identities.py @@ -79,11 +79,11 @@ class IdentitiesTableModel(QAbstractTableModel): """ super().__init__(parent) self.community = community - self.columns_titles = { - 'uid': self.tr('UID'), + self.columns_titles = {'uid': self.tr('UID'), 'pubkey': self.tr('Pubkey'), 'renewed': self.tr('Renewed'), - 'expiration': self.tr('Expiration')} + 'expiration': self.tr('Expiration'), + 'validation': self.tr('Validation')} self.columns_ids = ('uid', 'pubkey', 'renewed', 'expiration') self.identities_data = [] self._identities = []