diff --git a/src/cutecoin/core/account.py b/src/cutecoin/core/account.py index eb6ae82250caafc9b395a02cd43c102eda264100..a5806207fd85215698c9aa6e8de3c76f55c86398 100644 --- a/src/cutecoin/core/account.py +++ b/src/cutecoin/core/account.py @@ -113,12 +113,18 @@ class Account(object): def certify(self, password, community, pubkey): certified = Person.lookup(pubkey, community) - block = community.get_block() - block_hash = hashlib.sha1(block.signed_raw().encode("ascii")).hexdigest().upper() + + try: + block = community.get_block() + block_hash = hashlib.sha1(block.signed_raw().encode("ascii")).hexdigest().upper() + block_number = block['number'] + except ValueError as e: + block_number = 0 + block_hash = "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709" certification = Certification(PROTOCOL_VERSION, community.currency, self.pubkey, certified.pubkey, - block_hash, block.number, None) + block_hash, block_number, None) selfcert = certified.selfcert(community) logging.debug("SelfCertification : {0}".format(selfcert.raw()))