From f87c5cd141a2b8b6e2a99a762af842f3ff751258 Mon Sep 17 00:00:00 2001 From: Atheros1 Date: Tue, 20 Nov 2012 16:34:13 -0500 Subject: [PATCH] added line to show hash rate --- bitmessagemain.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bitmessagemain.py b/bitmessagemain.py index 6a962271..a2be93b2 100644 --- a/bitmessagemain.py +++ b/bitmessagemain.py @@ -892,7 +892,7 @@ class receiveDataThread(QThread): payload += eString nonce = 0 - trialValue = 99999999999999999 + trialValue = 99999999999999999999 target = 2**64 / ((len(payload)+payloadLengthExtraBytes+8) * averageProofOfWorkNonceTrialsPerByte) #The 108 added to the payload length is 8 for the size of the nonce + 50 as an extra penalty simply for having this seperate message exist. print '(For pubkey message) Doing proof of work...' while trialValue > target: @@ -1767,7 +1767,7 @@ class singleWorker(QThread): print 'eString', repr(eString) nonce = 0 - trialValue = 99999999999999999 + trialValue = 99999999999999999999 target = 2**64 / ((len(payload)+payloadLengthExtraBytes+8) * averageProofOfWorkNonceTrialsPerByte) print '(For broadcast message) Doing proof of work...' while trialValue > target: @@ -1882,19 +1882,19 @@ class singleWorker(QThread): outfile.close() nonce = 0 - trialValue = 99999999999999999 + trialValue = 99999999999999999999 embeddedTime = pack('>I',(int(time.time()))) encodedStreamNumber = encodeVarint(toStreamNumber) #We are now dropping the unencrypted data in payload since it has already been encrypted and replacing it with the encrypted payload that we will send out. payload = embeddedTime + encodedStreamNumber + encrypted target = 2**64 / ((len(payload)+payloadLengthExtraBytes+8) * averageProofOfWorkNonceTrialsPerByte) - print '(For msg message) Doing proof of work...' - print 'target', target + print '(For msg message) Doing proof of work. Target:', target + powStartTime = time.time() while trialValue > target: nonce += 1 trialValue, = unpack('>Q',hashlib.sha512(hashlib.sha512(pack('>Q',nonce) + payload).digest()).digest()[4:12]) print '(For msg message) Found proof of work', trialValue, 'Nonce:', nonce - + print 'POW took', int(time.time()-powStartTime), 'seconds.', nonce/(time.time()-powStartTime), 'nonce trials per second.' payload = pack('>Q',nonce) + payload inventoryHash = calculateInventoryHash(payload) @@ -1931,7 +1931,7 @@ class singleWorker(QThread): payload += encodeVarint(streamNumber) payload += ripe nonce = 0 - trialValue = 99999999999999999 + trialValue = 99999999999999999999 #print 'trial value', trialValue statusbar = 'Doing the computations necessary to request the recipient''s public key. (Doing the proof-of-work.)' self.emit(SIGNAL("updateStatusBar(PyQt_PyObject)"),statusbar) @@ -1962,7 +1962,7 @@ class singleWorker(QThread): def generateFullAckMessage(self,ackdata,toStreamNumber): nonce = 0 - trialValue = 99999999999999999 + trialValue = 99999999999999999999 embeddedTime = pack('>I',(int(time.time()))) encodedStreamNumber = encodeVarint(toStreamNumber) payload = embeddedTime + encodedStreamNumber + ackdata