From 6081863b281e130502d689b7b4fd120bce111bee Mon Sep 17 00:00:00 2001 From: Jonathan Warren Date: Sun, 22 Sep 2013 23:12:21 -0400 Subject: [PATCH] raise default demanded difficulty from 1 to 2 --- src/class_sqlThread.py | 8 ++++++++ src/helper_bootstrap.py | 2 +- src/helper_startup.py | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/class_sqlThread.py b/src/class_sqlThread.py index aa0382b9..829b243d 100644 --- a/src/class_sqlThread.py +++ b/src/class_sqlThread.py @@ -245,6 +245,14 @@ class sqlThread(threading.Thread): if not shared.config.has_option('bitmessagesettings', 'sendoutgoingconnections'): shared.config.set('bitmessagesettings', 'sendoutgoingconnections', 'True') + # Raise the default required difficulty from 1 to 2 + if shared.config.getint('bitmessagesettings', 'settingsversion') == 6: + if int(shared.config.get('bitmessagesettings','defaultnoncetrialsperbyte')) == shared.networkDefaultProofOfWorkNonceTrialsPerByte: + shared.config.set('bitmessagesettings','defaultnoncetrialsperbyte', str(shared.networkDefaultProofOfWorkNonceTrialsPerByte * 2)) + shared.config.set('bitmessagesettings', 'settingsversion', '7') + with open(shared.appdata + 'keys.dat', 'wb') as configfile: + shared.config.write(configfile) + # Are you hoping to add a new option to the keys.dat file of existing # Bitmessage users? Add it right above this line! diff --git a/src/helper_bootstrap.py b/src/helper_bootstrap.py index f0cae8f2..6b5b98dc 100644 --- a/src/helper_bootstrap.py +++ b/src/helper_bootstrap.py @@ -25,7 +25,7 @@ def knownNodes(): shared.knownNodes[stream][peer] = time except: shared.knownNodes = defaultKnownNodes.createDefaultKnownNodes(shared.appdata) - if shared.config.getint('bitmessagesettings', 'settingsversion') > 6: + if shared.config.getint('bitmessagesettings', 'settingsversion') > 7: print 'Bitmessage cannot read future versions of the keys file (keys.dat). Run the newer version of Bitmessage.' raise SystemExit diff --git a/src/helper_startup.py b/src/helper_startup.py index 05afcb9c..5a5d7b81 100644 --- a/src/helper_startup.py +++ b/src/helper_startup.py @@ -42,7 +42,7 @@ def loadConfig(): # This appears to be the first time running the program; there is # no config file (or it cannot be accessed). Create config file. shared.config.add_section('bitmessagesettings') - shared.config.set('bitmessagesettings', 'settingsversion', '6') + shared.config.set('bitmessagesettings', 'settingsversion', '7') shared.config.set('bitmessagesettings', 'port', '8444') shared.config.set( 'bitmessagesettings', 'timeformat', '%%a, %%d %%b %%Y %%I:%%M %%p') @@ -74,7 +74,7 @@ def loadConfig(): shared.config.set( 'bitmessagesettings', 'messagesencrypted', 'false') shared.config.set('bitmessagesettings', 'defaultnoncetrialsperbyte', str( - shared.networkDefaultProofOfWorkNonceTrialsPerByte)) + shared.networkDefaultProofOfWorkNonceTrialsPerByte * 2)) shared.config.set('bitmessagesettings', 'defaultpayloadlengthextrabytes', str( shared.networkDefaultPayloadLengthExtraBytes)) shared.config.set('bitmessagesettings', 'minimizeonclose', 'false')