(self)
| 32 | super(addressGenerator, self).stopThread() |
| 33 | |
| 34 | def run(self): |
| 35 | while state.shutdown == 0: |
| 36 | queueValue = queues.addressGeneratorQueue.get() |
| 37 | nonceTrialsPerByte = 0 |
| 38 | payloadLengthExtraBytes = 0 |
| 39 | live = True |
| 40 | if queueValue[0] == 'createChan': |
| 41 | command, addressVersionNumber, streamNumber, label, deterministicPassphrase, live = queueValue |
| 42 | eighteenByteRipe = False |
| 43 | numberOfAddressesToMake = 1 |
| 44 | numberOfNullBytesDemandedOnFrontOfRipeHash = 1 |
| 45 | elif queueValue[0] == 'joinChan': |
| 46 | command, chanAddress, label, deterministicPassphrase, live = queueValue |
| 47 | eighteenByteRipe = False |
| 48 | addressVersionNumber = decodeAddress(chanAddress)[1] |
| 49 | streamNumber = decodeAddress(chanAddress)[2] |
| 50 | numberOfAddressesToMake = 1 |
| 51 | numberOfNullBytesDemandedOnFrontOfRipeHash = 1 |
| 52 | elif len(queueValue) == 7: |
| 53 | command, addressVersionNumber, streamNumber, label, numberOfAddressesToMake, deterministicPassphrase, eighteenByteRipe = queueValue |
| 54 | try: |
| 55 | numberOfNullBytesDemandedOnFrontOfRipeHash = BMConfigParser().getint( |
| 56 | 'bitmessagesettings', 'numberofnullbytesonaddress') |
| 57 | except: |
| 58 | if eighteenByteRipe: |
| 59 | numberOfNullBytesDemandedOnFrontOfRipeHash = 2 |
| 60 | else: |
| 61 | numberOfNullBytesDemandedOnFrontOfRipeHash = 1 # the default |
| 62 | elif len(queueValue) == 9: |
| 63 | command, addressVersionNumber, streamNumber, label, numberOfAddressesToMake, deterministicPassphrase, eighteenByteRipe, nonceTrialsPerByte, payloadLengthExtraBytes = queueValue |
| 64 | try: |
| 65 | numberOfNullBytesDemandedOnFrontOfRipeHash = BMConfigParser().getint( |
| 66 | 'bitmessagesettings', 'numberofnullbytesonaddress') |
| 67 | except: |
| 68 | if eighteenByteRipe: |
| 69 | numberOfNullBytesDemandedOnFrontOfRipeHash = 2 |
| 70 | else: |
| 71 | numberOfNullBytesDemandedOnFrontOfRipeHash = 1 # the default |
| 72 | elif queueValue[0] == 'stopThread': |
| 73 | break |
| 74 | else: |
| 75 | sys.stderr.write( |
| 76 | 'Programming error: A structure with the wrong number of values was passed into the addressGeneratorQueue. Here is the queueValue: %s\n' % repr(queueValue)) |
| 77 | if addressVersionNumber < 3 or addressVersionNumber > 4: |
| 78 | sys.stderr.write( |
| 79 | 'Program error: For some reason the address generator queue has been given a request to create at least one version %s address which it cannot do.\n' % addressVersionNumber) |
| 80 | if nonceTrialsPerByte == 0: |
| 81 | nonceTrialsPerByte = BMConfigParser().getint( |
| 82 | 'bitmessagesettings', 'defaultnoncetrialsperbyte') |
| 83 | if nonceTrialsPerByte < defaults.networkDefaultProofOfWorkNonceTrialsPerByte: |
| 84 | nonceTrialsPerByte = defaults.networkDefaultProofOfWorkNonceTrialsPerByte |
| 85 | if payloadLengthExtraBytes == 0: |
| 86 | payloadLengthExtraBytes = BMConfigParser().getint( |
| 87 | 'bitmessagesettings', 'defaultpayloadlengthextrabytes') |
| 88 | if payloadLengthExtraBytes < defaults.networkDefaultPayloadLengthExtraBytes: |
| 89 | payloadLengthExtraBytes = defaults.networkDefaultPayloadLengthExtraBytes |
| 90 | if command == 'createRandomAddress': |
| 91 | queues.UISignalQueue.put(( |
nothing calls this directly
no test coverage detected