From 4b72a433c6ab6babc9fa24d3f0dd14101c073941 Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Thu, 7 Mar 2019 14:21:07 +0200 Subject: [PATCH] New config setting - `extralowdifficulty` to use for testing: replaces shared.useVeryEasyProofOfWorkForTesting and automatically applies to test-mode. --- src/bitmessagemain.py | 18 +++++++----------- src/shared.py | 3 --- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/bitmessagemain.py b/src/bitmessagemain.py index d86e04b9..4efd0154 100755 --- a/src/bitmessagemain.py +++ b/src/bitmessagemain.py @@ -69,7 +69,6 @@ import helper_threading def connectToStream(streamNumber): state.streamsInWhichIAmParticipating.append(streamNumber) - selfInitiatedConnections[streamNumber] = {} if isOurOperatingSystemLimitedToHavingVeryFewHalfOpenConnections(): # Some XP and Vista systems can only have 10 outgoing connections @@ -184,16 +183,6 @@ def signal_handler(signum, frame): ' because the UI captures the signal.') -# This is a list of current connections (the thread pointers at least) -selfInitiatedConnections = {} - -if shared.useVeryEasyProofOfWorkForTesting: - defaults.networkDefaultProofOfWorkNonceTrialsPerByte = int( - defaults.networkDefaultProofOfWorkNonceTrialsPerByte / 100) - defaults.networkDefaultPayloadLengthExtraBytes = int( - defaults.networkDefaultPayloadLengthExtraBytes / 100) - - class Main: def start(self): _fixSocket() @@ -274,6 +263,13 @@ class Main: 'bitmessagesettings', 'sendoutgoingconnections'): state.dandelion = 0 + if state.testmode or BMConfigParser().safeGetBoolean( + 'bitmessagesettings', 'extralowdifficulty'): + defaults.networkDefaultProofOfWorkNonceTrialsPerByte = int( + defaults.networkDefaultProofOfWorkNonceTrialsPerByte / 100) + defaults.networkDefaultPayloadLengthExtraBytes = int( + defaults.networkDefaultPayloadLengthExtraBytes / 100) + knownnodes.readKnownNodes() # Not needed if objproc is disabled diff --git a/src/shared.py b/src/shared.py index 4b2c7a5c..6d03bcca 100644 --- a/src/shared.py +++ b/src/shared.py @@ -30,9 +30,6 @@ maximumAgeOfAnObjectThatIAmWillingToAccept = 216000 # from obtaining a needed pubkey for a period of time. lengthOfTimeToHoldOnToAllPubkeys = 2419200 maximumAgeOfNodesThatIAdvertiseToOthers = 10800 # Equals three hours -# If you set this to True while on the normal network, -# you won't be able to send or sometimes receive messages. -useVeryEasyProofOfWorkForTesting = False myECCryptorObjects = {}