diff --git a/src/class_singleWorker.py b/src/class_singleWorker.py index 2680f307..59d72ac3 100644 --- a/src/class_singleWorker.py +++ b/src/class_singleWorker.py @@ -147,17 +147,26 @@ class singleWorker(threading.Thread): shared.broadcastToSendDataQueues(( streamNumber, 'advertiseobject', inventoryHash)) shared.UISignalQueue.put(('updateStatusBar', '')) - shared.config.set( - myAddress, 'lastpubkeysendtime', str(int(time.time()))) - with open(shared.appdata + 'keys.dat', 'wb') as configfile: - shared.config.write(configfile) + try: + shared.config.set( + myAddress, 'lastpubkeysendtime', str(int(time.time()))) + with open(shared.appdata + 'keys.dat', 'wb') as configfile: + shared.config.write(configfile) + except: + # The user deleted the address out of the keys.dat file before this + # finished. + pass # If this isn't a chan address, this function assembles the pubkey data, # does the necessary POW and sends it out. If it *is* a chan then it # assembles the pubkey and stores is in the pubkey table so that we can # send messages to "ourselves". def sendOutOrStoreMyV3Pubkey(self, hash): - myAddress = shared.myAddressesByHash[hash] + try: + myAddress = shared.myAddressesByHash[hash] + except: + #The address has been deleted. + return if shared.safeConfigGetBoolean(myAddress, 'chan'): with shared.printLock: print 'This is a chan address. Not sending pubkey.' @@ -224,14 +233,22 @@ class singleWorker(threading.Thread): shared.broadcastToSendDataQueues(( streamNumber, 'advertiseobject', inventoryHash)) shared.UISignalQueue.put(('updateStatusBar', '')) - shared.config.set( - myAddress, 'lastpubkeysendtime', str(int(time.time()))) - with open(shared.appdata + 'keys.dat', 'wb') as configfile: - shared.config.write(configfile) + try: + shared.config.set( + myAddress, 'lastpubkeysendtime', str(int(time.time()))) + with open(shared.appdata + 'keys.dat', 'wb') as configfile: + shared.config.write(configfile) + except: + # The user deleted the address out of the keys.dat file before this + # finished. + pass # If this isn't a chan address, this function assembles the pubkey data, # does the necessary POW and sends it out. def sendOutOrStoreMyV4Pubkey(self, myAddress): + if not shared.config.has_section(myAddress): + #The address has been deleted. + return if shared.safeConfigGetBoolean(myAddress, 'chan'): with shared.printLock: print 'This is a chan address. Not sending pubkey.'