maximumAgeOfAnObjectThatIAmWillingToAccept=216000# Equals two days and 12 hours.
lengthOfTimeToLeaveObjectsInInventory=237600# Equals two days and 18 hours. This should be longer than maximumAgeOfAnObjectThatIAmWillingToAccept so that we don't process messages twice.
lengthOfTimeToHoldOnToAllPubkeys=2419200# Equals 4 weeks. You could make this longer if you want but making it shorter would not be advisable because there is a very small possibility that it could keep you from obtaining a needed pubkey for a period of time.
maximumAgeOfObjectsThatIAdvertiseToOthers=216000# Equals two days and 12 hours
maximumAgeOfNodesThatIAdvertiseToOthers=10800# Equals three hours
useVeryEasyProofOfWorkForTesting=False# If you set this to True while on the normal network, you won't be able to send or sometimes receive messages.
myAddressesByHash={}#The key in this dictionary is the RIPE hash which is encoded in an address and value is the address itself.
broadcastSendersForWhichImWatching={}
workerQueue=Queue.Queue()
sqlSubmitQueue=Queue.Queue()#SQLITE3 is so thread-unsafe that they won't even let you call it from different threads using your own locks. SQL objects can only be called from one thread.
sqlReturnQueue=Queue.Queue()
sqlLock=threading.Lock()
UISignalQueue=Queue.Queue()
addressGeneratorQueue=Queue.Queue()
knownNodesLock=threading.Lock()
knownNodes={}
sendDataQueues=[]#each sendData thread puts its queue in this list.
inventory={}#of objects (like msg payloads and pubkey payloads) Does not include protocol headers (the first 24 bytes of each packet).
inventoryLock=threading.Lock()#Guarantees that two receiveDataThreads don't receive and process the same message concurrently (probably sent by a malicious individual)
printLock=threading.Lock()
appdata=''#holds the location of the application data storage directory
connectedHostsList={}#List of hosts to which we are connected. Used to guarantee that the outgoingSynSender threads won't connect to the same remote node twice.
time.time())# used to clear out the alreadyAttemptedConnectionsList periodically so that we will retry connecting to hosts to which we have already tried to connect.
#If changed, these values will cause particularly unexpected behavior: You won't be able to either send or receive messages because the proof of work you do (or demand) won't match that done or demanded by others. Don't change them!
networkDefaultProofOfWorkNonceTrialsPerByte=320#The amount of work that should be performed (and demanded) per byte of the payload. Double this number to double the work.
networkDefaultPayloadLengthExtraBytes=14000#To make sending short messages a little more difficult, this value is added to the payload length for use in calculating the proof of work target.
sys.stderr.write('Major problem! When trying to decode one of your private keys, the checksum failed. Here is the PRIVATE key: %s\n'%str(WIFstring))
return""
else:
#checksum passed
ifprivkey[0]=='\x80':
returnprivkey[1:]
else:
sys.stderr.write('Major problem! When trying to decode one of your private keys, the checksum passed but the key doesn\'t begin with hex 80. Here is the PRIVATE key: %s\n'%str(WIFstring))
privEncryptionKey=decodeWalletImportFormat(config.get(addressInKeysFile,'privencryptionkey')).encode('hex')#returns a simple 32 bytes of information encoded in 64 Hex characters, or null if there was an error
iflen(privEncryptionKey)==64:#It is 32 bytes encoded as 64 hex characters
#Now, for all addresses, even version 2 addresses, we should create Cryptor objects in a dictionary which we will use to attempt to decrypt encrypted broadcast messages.
time.sleep(.25)#Wait long enough to guarantee that any running proof of work worker threads will check the shutdown variable and exit. If the main thread closes before they do then they won't stop.
#When you want to command a sendDataThread to do something, like shutdown or send some data, this function puts your data into the queues for each of the sendDataThreads. The sendDataThreads are responsible for putting their queue into (and out of) the sendDataQueues list.
#Note that the singleCleanerThread clears out the inventory dictionary from time to time, although it only clears things that have been in the dictionary for a long time. This clears the inventory dictionary Now.