Merge pull request #42 from Atheros1/master

The embedded time is needed.
This commit is contained in:
Jonathan Warren 2013-02-11 14:04:49 -08:00
commit 0ddf9203ee

View File

@ -1256,7 +1256,7 @@ class receiveDataThread(QThread):
def processpubkey(self): def processpubkey(self):
readPosition = 24 #for the message header readPosition = 24 #for the message header
readPosition += 8 #for the nonce readPosition += 8 #for the nonce
#embeddedTime, = unpack('>I',self.data[readPosition:readPosition+4]) #We don't need the time in this processpubkey function. It was checked earlier in the recpubkey function. embeddedTime, = unpack('>I',self.data[readPosition:readPosition+4])
readPosition += 4 #for the time readPosition += 4 #for the time
addressVersion, varintLength = decodeVarint(self.data[readPosition:readPosition+10]) addressVersion, varintLength = decodeVarint(self.data[readPosition:readPosition+10])
readPosition += varintLength readPosition += varintLength
@ -1439,7 +1439,7 @@ class receiveDataThread(QThread):
printLock.release() printLock.release()
inventoryHash = calculateInventoryHash(payload) inventoryHash = calculateInventoryHash(payload)
objectType = 'pubkey' objectType = 'pubkey'
inventory[inventoryHash] = (objectType, self.streamNumber, payload, timeEncodedInPubkey) inventory[inventoryHash] = (objectType, self.streamNumber, payload, timeEncodedInPubkey)#If the time embedded in this pubkey is more than 3 days old then this object isn't going to last very long in the inventory- the cleanerThread is going to come along and move it from the inventory in memory to the SQL inventory and then delete it from the SQL inventory. It should still find its way back to the original requestor if he is online however.
self.broadcastinv(inventoryHash) 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.) 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.)
if self.data[36+addressVersionLength+streamNumberLength:56+addressVersionLength+streamNumberLength] in myECAddressHashes: #if this address hash is one of mine if self.data[36+addressVersionLength+streamNumberLength:56+addressVersionLength+streamNumberLength] in myECAddressHashes: #if this address hash is one of mine