Proto v3 #727
|
@ -2347,12 +2347,31 @@ class MyForm(QtGui.QMainWindow):
|
||||||
if float(self.settingsDialogInstance.ui.lineEditSmallMessageDifficulty.text()) >= 1:
|
if float(self.settingsDialogInstance.ui.lineEditSmallMessageDifficulty.text()) >= 1:
|
||||||
shared.config.set('bitmessagesettings', 'defaultpayloadlengthextrabytes', str(int(float(
|
shared.config.set('bitmessagesettings', 'defaultpayloadlengthextrabytes', str(int(float(
|
||||||
self.settingsDialogInstance.ui.lineEditSmallMessageDifficulty.text()) * shared.networkDefaultPayloadLengthExtraBytes)))
|
self.settingsDialogInstance.ui.lineEditSmallMessageDifficulty.text()) * shared.networkDefaultPayloadLengthExtraBytes)))
|
||||||
|
|
||||||
|
acceptableDifficultyChanged = False
|
||||||
|
|
||||||
if float(self.settingsDialogInstance.ui.lineEditMaxAcceptableTotalDifficulty.text()) >= 1 or float(self.settingsDialogInstance.ui.lineEditMaxAcceptableTotalDifficulty.text()) == 0:
|
if float(self.settingsDialogInstance.ui.lineEditMaxAcceptableTotalDifficulty.text()) >= 1 or float(self.settingsDialogInstance.ui.lineEditMaxAcceptableTotalDifficulty.text()) == 0:
|
||||||
|
if shared.config.get('bitmessagesettings','maxacceptablenoncetrialsperbyte') != str(int(float(
|
||||||
|
self.settingsDialogInstance.ui.lineEditMaxAcceptableTotalDifficulty.text()) * shared.networkDefaultProofOfWorkNonceTrialsPerByte)):
|
||||||
|
# the user changed the max acceptable total difficulty
|
||||||
|
acceptableDifficultyChanged = True
|
||||||
shared.config.set('bitmessagesettings', 'maxacceptablenoncetrialsperbyte', str(int(float(
|
shared.config.set('bitmessagesettings', 'maxacceptablenoncetrialsperbyte', str(int(float(
|
||||||
self.settingsDialogInstance.ui.lineEditMaxAcceptableTotalDifficulty.text()) * shared.networkDefaultProofOfWorkNonceTrialsPerByte)))
|
self.settingsDialogInstance.ui.lineEditMaxAcceptableTotalDifficulty.text()) * shared.networkDefaultProofOfWorkNonceTrialsPerByte)))
|
||||||
if float(self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) >= 1 or float(self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) == 0:
|
if float(self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) >= 1 or float(self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) == 0:
|
||||||
|
if shared.config.get('bitmessagesettings','maxacceptablepayloadlengthextrabytes') != str(int(float(
|
||||||
|
self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) * shared.networkDefaultPayloadLengthExtraBytes)):
|
||||||
|
# the user changed the max acceptable small message difficulty
|
||||||
|
acceptableDifficultyChanged = True
|
||||||
shared.config.set('bitmessagesettings', 'maxacceptablepayloadlengthextrabytes', str(int(float(
|
shared.config.set('bitmessagesettings', 'maxacceptablepayloadlengthextrabytes', str(int(float(
|
||||||
self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) * shared.networkDefaultPayloadLengthExtraBytes)))
|
self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) * shared.networkDefaultPayloadLengthExtraBytes)))
|
||||||
|
if acceptableDifficultyChanged:
|
||||||
|
# It might now be possible to send msgs which were previously marked as toodifficult.
|
||||||
|
# Let us change them to 'msgqueued'. The singleWorker will try to send them and will again
|
||||||
|
# mark them as toodifficult if the receiver's required difficulty is still higher than
|
||||||
|
# we are willing to do.
|
||||||
|
sqlExecute('''UPDATE sent SET status='msgqueued' WHERE status='toodifficult' ''')
|
||||||
|
shared.workerQueue.put(('sendmessage', ''))
|
||||||
|
|
||||||
#start:UI setting to stop trying to send messages after X days/months
|
#start:UI setting to stop trying to send messages after X days/months
|
||||||
# I'm open to changing this UI to something else if someone has a better idea.
|
# I'm open to changing this UI to something else if someone has a better idea.
|
||||||
if ((self.settingsDialogInstance.ui.lineEditDays.text()=='') and (self.settingsDialogInstance.ui.lineEditMonths.text()=='')):#We need to handle this special case. Bitmessage has its default behavior. The input is blank/blank
|
if ((self.settingsDialogInstance.ui.lineEditDays.text()=='') and (self.settingsDialogInstance.ui.lineEditMonths.text()=='')):#We need to handle this special case. Bitmessage has its default behavior. The input is blank/blank
|
||||||
|
|
|
@ -515,14 +515,9 @@ class singleWorker(threading.Thread):
|
||||||
def sendMsg(self):
|
def sendMsg(self):
|
||||||
while True: # while we have a msg that needs some work
|
while True: # while we have a msg that needs some work
|
||||||
|
|
||||||
# Select just one msg that needs work. We'll get a msg
|
# Select just one msg that needs work.
|
||||||
# which is ready to be sent or a msg which we have sent in
|
|
||||||
# the last 28 days which were previously marked
|
|
||||||
# as 'toodifficult'. If the user has raised the maximum acceptable
|
|
||||||
# difficulty then those msgs may now be sendable.
|
|
||||||
queryreturn = sqlQuery(
|
queryreturn = sqlQuery(
|
||||||
'''SELECT toaddress, toripe, fromaddress, subject, message, ackdata, status FROM sent WHERE (status='msgqueued' or status='doingmsgpow' or status='forcepow' or (status='toodifficult' and lastactiontime>?)) and folder='sent' LIMIT 1''',
|
'''SELECT toaddress, toripe, fromaddress, subject, message, ackdata, status FROM sent WHERE (status='msgqueued' or status='doingmsgpow' or status='forcepow') and folder='sent' LIMIT 1''')
|
||||||
int(time.time()) - 2419200)
|
|
||||||
if len(queryreturn) == 0: # if there is no work to do then
|
if len(queryreturn) == 0: # if there is no work to do then
|
||||||
break # break out of this sendMsg loop and
|
break # break out of this sendMsg loop and
|
||||||
# wait for something to get put in the shared.workerQueue.
|
# wait for something to get put in the shared.workerQueue.
|
||||||
|
@ -717,7 +712,7 @@ class singleWorker(threading.Thread):
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
'''UPDATE sent SET status='toodifficult' WHERE ackdata=? ''',
|
'''UPDATE sent SET status='toodifficult' WHERE ackdata=? ''',
|
||||||
ackdata)
|
ackdata)
|
||||||
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (ackdata, tr.translateText("MainWindow", "Problem: The work demanded by the recipient (%1 and %2) is more difficult than you are willing to do.").arg(str(float(requiredAverageProofOfWorkNonceTrialsPerByte) / shared.networkDefaultProofOfWorkNonceTrialsPerByte)).arg(str(float(
|
shared.UISignalQueue.put(('updateSentItemStatusByAckdata', (ackdata, tr.translateText("MainWindow", "Problem: The work demanded by the recipient (%1 and %2) is more difficult than you are willing to do. %3").arg(str(float(requiredAverageProofOfWorkNonceTrialsPerByte) / shared.networkDefaultProofOfWorkNonceTrialsPerByte)).arg(str(float(
|
||||||
requiredPayloadLengthExtraBytes) / shared.networkDefaultPayloadLengthExtraBytes)).arg(l10n.formatTimestamp()))))
|
requiredPayloadLengthExtraBytes) / shared.networkDefaultPayloadLengthExtraBytes)).arg(l10n.formatTimestamp()))))
|
||||||
continue
|
continue
|
||||||
else: # if we are sending a message to ourselves or a chan..
|
else: # if we are sending a message to ourselves or a chan..
|
||||||
|
|
Reference in New Issue
Block a user