@ -12,7 +12,7 @@ lengthOfTimeToLeaveObjectsInInventory = 237600 #Equals two days and 18 hours. Th
maximumAgeOfObjectsThatIAdvertiseToOthers=216000#Equals two days and 12 hours
maximumAgeOfNodesThatIAdvertiseToOthers=10800#Equals three hours
storeConfigFilesInSameDirectoryAsProgram=False
userVeryEasyProofOfWorkForTesting =True #If you set this to True while on the normal network, you won't be able to send or sometimes receive messages.
useVeryEasyProofOfWorkForTesting =False #If you set this to True while on the normal network, you won't be able to send or sometimes receive messages.
importsys
try:
@ -1231,91 +1231,38 @@ class receiveDataThread(QThread):
print'The addressVersionNumber of the pubkey request is too high. Can\'t understand. Ignoring it.'
return
print'the hash requested in this getpubkey request is:',self.data[36+addressVersionLength+streamNumberLength:56+addressVersionLength+streamNumberLength].encode('hex')
ifself.data[36+addressVersionLength+streamNumberLength:56+addressVersionLength+streamNumberLength]inmyECAddressHashes:#if this address hash is one of mine
print'Found getpubkey requested hash in my list of EC hashes.'
#check to see whether we have already calculated the nonce and transmitted this key before
sqlLock.acquire()#released at the bottom of this payload generation section
print'(For pubkey message) Found proof of work',trialValue,'Nonce:',nonce
payload=pack('>Q',nonce)+payload
t=(self.data[36+addressVersionLength+streamNumberLength:56+addressVersionLength+streamNumberLength],True,payload,int(time.time())+1209600)#after two weeks (1,209,600 seconds), we may remove our own pub key from our database. It will be regenerated and put back in the database if it is requested.
sqlSubmitQueue.put('''INSERT INTO pubkeys VALUES (?,?,?,?)''')
sqlSubmitQueue.put(t)
queryreturn=sqlReturnQueue.get()
#Now that we have the full pubkey message ready either from making it just now or making it earlier, we can send it out.
sqlSubmitQueue.put('SELECT * FROM pubkeys WHERE hash=?')
sqlSubmitQueue.put(t)
queryreturn=sqlReturnQueue.get()
#print 'queryreturn', queryreturn
self.broadcastinv(inventoryHash)
else:#the pubkey is not in our database of pubkeys. Let's check if the requested key is ours (which would mean we should do the POW, put it in the pubkey table, and broadcast out the pubkey.
ifself.data[36+addressVersionLength+streamNumberLength:56+addressVersionLength+streamNumberLength]inmyECAddressHashes:#if this address hash is one of mine
print'Found getpubkey-requested-hash in my list of EC hashes. Telling Worker thread to do the POW for a pubkey message and send it out.'
@ -1338,61 +1285,20 @@ class receiveDataThread(QThread):
payload=pack('>Q',nonce)+payload
t=(self.data[36+addressVersionLength+streamNumberLength:56+addressVersionLength+streamNumberLength],True,payload,int(time.time())+1209600)#after two weeks (1,209,600 seconds), we may remove our own pub key from our database. It will be regenerated and put back in the database if it is requested.
sqlLock.acquire()
sqlSubmitQueue.put('''INSERT INTO pubkeys VALUES (?,?,?,?)''')
sqlSubmitQueue.put(t)
queryreturn=sqlReturnQueue.get()
#Now that we have the full pubkey message ready either from making it just now or making it earlier, we can send it out.
#This section hasn't been tested yet. Criteria for success: Alice sends Bob a message. Three days later, Charlie who is completely new to Bitmessage runs the client for the first time then sends a message to Bob and accomplishes this without Bob having to redo the POW for a pubkey message.
print'Hash in getpubkey request is not for any of my keys.'
#..but lets see if we have it stored from when it came in from someone else.
print'(For pubkey message) Found proof of work',trialValue,'Nonce:',nonce
payload=pack('>Q',nonce)+payload
t=(hash,True,payload,int(time.time())+1209600)#after two weeks (1,209,600 seconds), we may remove our own pub key from our database. It will be regenerated and put back in the database if it is requested.
sqlLock.acquire()
sqlSubmitQueue.put('''INSERT INTO pubkeys VALUES (?,?,?,?)''')
@ -3449,10 +3412,7 @@ class MyForm(QtGui.QMainWindow):
self.statusBar().showMessage('')
ifconnectionsCount[streamNumber]==0:
self.statusBar().showMessage('Warning: You are currently not connected. Bitmessage will do the work necessary to send the message but it won\'t send until you connect.')
ackdata=''
foriinrange(4):#This will make 32 bytes of random data.
sqlSubmitQueue.put('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?)''')
@ -4212,7 +4172,7 @@ neededPubkeys = {}
averageProofOfWorkNonceTrialsPerByte=320#The amount of work that should be performed (and demanded) per byte of the payload. Double this number to double the work.
payloadLengthExtraBytes=14000#To make sending short messages a little more difficult, this value is added to the payload length for use in calculating the proof of work target.