From ef500501d799deb953ff764dbc265ac19270782f Mon Sep 17 00:00:00 2001 From: Jonathan Warren Date: Sat, 21 Sep 2013 13:30:46 -0400 Subject: [PATCH] small fixes to address generator and listAddresses2 --- src/bitmessagemain.py | 2 +- src/class_addressGenerator.py | 24 ++++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/bitmessagemain.py b/src/bitmessagemain.py index 29768afa..3d7f5c73 100755 --- a/src/bitmessagemain.py +++ b/src/bitmessagemain.py @@ -197,7 +197,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): else: chan = False label = shared.config.get(addressInKeysFile, 'label') - if method == listAddresses2: + if method == 'listAddresses2': label = label.encode('base64') data += json.dumps({'label': label, 'address': addressInKeysFile, 'stream': streamNumber, 'enabled': shared.config.getboolean(addressInKeysFile, 'enabled'), 'chan': chan}, indent=4, separators=(',', ': ')) diff --git a/src/class_addressGenerator.py b/src/class_addressGenerator.py index 3d0611d5..c6e99a4b 100644 --- a/src/class_addressGenerator.py +++ b/src/class_addressGenerator.py @@ -21,14 +21,6 @@ class addressGenerator(threading.Thread): queueValue = shared.addressGeneratorQueue.get() nonceTrialsPerByte = 0 payloadLengthExtraBytes = 0 - try: - numberOfNullBytesDemandedOnFrontOfRipeHash = shared.config.getint( - 'bitmessagesettings', 'numberofnullbytesonaddress') - except: - if eighteenByteRipe: - numberOfNullBytesDemandedOnFrontOfRipeHash = 2 - else: - numberOfNullBytesDemandedOnFrontOfRipeHash = 1 # the default if queueValue[0] == 'createChan': command, addressVersionNumber, streamNumber, label, deterministicPassphrase = queueValue eighteenByteRipe = False @@ -43,8 +35,24 @@ class addressGenerator(threading.Thread): numberOfNullBytesDemandedOnFrontOfRipeHash = 1 elif len(queueValue) == 7: command, addressVersionNumber, streamNumber, label, numberOfAddressesToMake, deterministicPassphrase, eighteenByteRipe = queueValue + try: + numberOfNullBytesDemandedOnFrontOfRipeHash = shared.config.getint( + 'bitmessagesettings', 'numberofnullbytesonaddress') + except: + if eighteenByteRipe: + numberOfNullBytesDemandedOnFrontOfRipeHash = 2 + else: + numberOfNullBytesDemandedOnFrontOfRipeHash = 1 # the default elif len(queueValue) == 9: command, addressVersionNumber, streamNumber, label, numberOfAddressesToMake, deterministicPassphrase, eighteenByteRipe, nonceTrialsPerByte, payloadLengthExtraBytes = queueValue + try: + numberOfNullBytesDemandedOnFrontOfRipeHash = shared.config.getint( + 'bitmessagesettings', 'numberofnullbytesonaddress') + except: + if eighteenByteRipe: + numberOfNullBytesDemandedOnFrontOfRipeHash = 2 + else: + numberOfNullBytesDemandedOnFrontOfRipeHash = 1 # the default else: sys.stderr.write( 'Programming error: A structure with the wrong number of values was passed into the addressGeneratorQueue. Here is the queueValue: %s\n' % repr(queueValue))