UTC time in pseudo-mailing-list broadcasts #106

Merged
Atheros1 merged 3 commits from master into master 2013-04-04 20:45:54 +02:00
Showing only changes of commit 396df086ff - Show all commits

View File

@ -1287,37 +1287,30 @@ class receiveDataThread(QThread):
print 'sending pubkey' print 'sending pubkey'
headerData = '\xe9\xbe\xb4\xd9' #magic bits, slighly different from Bitcoin's magic bits. headerData = '\xe9\xbe\xb4\xd9' #magic bits, slighly different from Bitcoin's magic bits.
headerData += 'pubkey\x00\x00\x00\x00\x00\x00' headerData += 'pubkey\x00\x00\x00\x00\x00\x00'
headerData += pack('>L',len(payload)) #payload length. Note that we add an extra 8 for the nonce. headerData += pack('>L',len(payload)) #payload length.
headerData += hashlib.sha512(payload).digest()[:4] headerData += hashlib.sha512(payload).digest()[:4]
self.sock.send(headerData + payload) self.sock.send(headerData + payload)
elif objectType == 'getpubkey': elif objectType == 'getpubkey' or objectType == 'pubkeyrequest':
print 'sending getpubkey' print 'sending getpubkey'
headerData = '\xe9\xbe\xb4\xd9' #magic bits, slighly different from Bitcoin's magic bits. headerData = '\xe9\xbe\xb4\xd9' #magic bits, slighly different from Bitcoin's magic bits.
headerData += 'getpubkey\x00\x00\x00' headerData += 'getpubkey\x00\x00\x00'
headerData += pack('>L',len(payload)) #payload length. Note that we add an extra 8 for the nonce. headerData += pack('>L',len(payload)) #payload length.
headerData += hashlib.sha512(payload).digest()[:4] headerData += hashlib.sha512(payload).digest()[:4]
self.sock.send(headerData + payload) self.sock.send(headerData + payload)
elif objectType == 'msg': elif objectType == 'msg':
print 'sending msg' print 'sending msg'
headerData = '\xe9\xbe\xb4\xd9' #magic bits, slighly different from Bitcoin's magic bits. headerData = '\xe9\xbe\xb4\xd9' #magic bits, slighly different from Bitcoin's magic bits.
headerData += 'msg\x00\x00\x00\x00\x00\x00\x00\x00\x00' headerData += 'msg\x00\x00\x00\x00\x00\x00\x00\x00\x00'
headerData += pack('>L',len(payload)) #payload length. Note that we add an extra 8 for the nonce. headerData += pack('>L',len(payload)) #payload length.
headerData += hashlib.sha512(payload).digest()[:4] headerData += hashlib.sha512(payload).digest()[:4]
self.sock.send(headerData + payload) self.sock.send(headerData + payload)
elif objectType == 'broadcast': elif objectType == 'broadcast':
print 'sending broadcast' print 'sending broadcast'
headerData = '\xe9\xbe\xb4\xd9' #magic bits, slighly different from Bitcoin's magic bits. headerData = '\xe9\xbe\xb4\xd9' #magic bits, slighly different from Bitcoin's magic bits.
headerData += 'broadcast\x00\x00\x00' headerData += 'broadcast\x00\x00\x00'
headerData += pack('>L',len(payload)) #payload length. Note that we add an extra 8 for the nonce. headerData += pack('>L',len(payload)) #payload length.
headerData += hashlib.sha512(payload).digest()[:4] headerData += hashlib.sha512(payload).digest()[:4]
self.sock.send(headerData + payload) self.sock.send(headerData + payload)
elif objectType == 'getpubkey' or objectType == 'pubkeyrequest':
print 'sending getpubkey'
headerData = '\xe9\xbe\xb4\xd9' #magic bits, slighly different from Bitcoin's magic bits.
headerData += 'getpubkey\x00\x00\x00' #version command
headerData += pack('>L',len(payload)) #payload length
headerData += hashlib.sha512(payload).digest()[0:4]
self.sock.send(headerData + payload)
else: else:
sys.stderr.write('Error: sendData has been asked to send a strange objectType: %s\n' % str(objectType)) sys.stderr.write('Error: sendData has been asked to send a strange objectType: %s\n' % str(objectType))