diff --git a/src/cutecoin/core/account.py b/src/cutecoin/core/account.py index 371aff88a0505d127d6075b35b2e27fc595eb4f2..5e6a66f8a960bf6a02acb07e9d0a4579454b4eb7 100644 --- a/src/cutecoin/core/account.py +++ b/src/cutecoin/core/account.py @@ -437,29 +437,32 @@ class Account(QObject): blockid = yield from community.blockid() identity = yield from self._identities_registry.future_find(pubkey, community) selfcert = yield from identity.selfcert(community) - certification = Certification(PROTOCOL_VERSION, community.currency, - self.pubkey, pubkey, - blockid.number, blockid.sha_hash, None) - - key = SigningKey(self.salt, password) - certification.sign(selfcert, [key]) - signed_cert = certification.signed_raw(selfcert) - logging.debug("Certification : {0}".format(signed_cert)) - - data = {'pubkey': pubkey, - 'self_': selfcert.signed_raw(), - 'other': "{0}\n".format(certification.inline())} - logging.debug("Posted data : {0}".format(data)) - responses = yield from community.bma_access.broadcast(bma.wot.Add, {}, data) - result = (False, "") - for r in responses: - if r.status == 200: - result = (True, (yield from r.json())) - elif not result[0]: - result = (False, (yield from r.text())) - else: - yield from r.release() - return result + if selfcert: + certification = Certification(PROTOCOL_VERSION, community.currency, + self.pubkey, pubkey, + blockid.number, blockid.sha_hash, None) + + key = SigningKey(self.salt, password) + certification.sign(selfcert, [key]) + signed_cert = certification.signed_raw(selfcert) + logging.debug("Certification : {0}".format(signed_cert)) + + data = {'pubkey': pubkey, + 'self_': selfcert.signed_raw(), + 'other': "{0}\n".format(certification.inline())} + logging.debug("Posted data : {0}".format(data)) + responses = yield from community.bma_access.broadcast(bma.wot.Add, {}, data) + result = (False, "") + for r in responses: + if r.status == 200: + result = (True, (yield from r.json())) + elif not result[0]: + result = (False, (yield from r.text())) + else: + yield from r.release() + return result + else: + return (False, self.tr("Could not find user self certification.")) @asyncio.coroutine def revoke(self, password, community): diff --git a/src/cutecoin/gui/certification.py b/src/cutecoin/gui/certification.py index 79551a91bf36eb26a88a2d6495f2d6177ebdbe19..3ec8c7387f2e4355c9edf6ef62fbed07ce926ef0 100644 --- a/src/cutecoin/gui/certification.py +++ b/src/cutecoin/gui/certification.py @@ -114,4 +114,4 @@ class CertificationDialog(QDialog, Ui_CertificationDialog): future = asyncio.Future() self.finished.connect(lambda r: future.set_result(r)) self.open() - return future \ No newline at end of file + return future