increase POW when resending objects

Automatically increase defaultpayloadlengthextrabytes when resending objects to get higher priority in the object inventories of other clients. In this way, since class_receiveDataThread.py has also been patched to order the inventory by POW strength, only low POW "spamers" will be denied service when the network is overloaded because clients trying to originate legitimate messages will automatically compute a increasingly stronger POWs until distinguishing themselves as more worthy of the network's limited resources.
This commit is contained in:
a3284642 2014-09-19 01:57:32 +00:00
parent 13db5fe00c
commit d669ef764f

View File

@ -94,9 +94,11 @@ class singleCleaner(threading.Thread):
toaddress, toripe, fromaddress, subject, message, ackdata, lastactiontime, status, pubkeyretrynumber, msgretrynumber = row toaddress, toripe, fromaddress, subject, message, ackdata, lastactiontime, status, pubkeyretrynumber, msgretrynumber = row
if status == 'awaitingpubkey': if status == 'awaitingpubkey':
if (int(time.time()) - lastactiontime) > (shared.maximumAgeOfAnObjectThatIAmWillingToAccept * (2 ** (pubkeyretrynumber))): if (int(time.time()) - lastactiontime) > (shared.maximumAgeOfAnObjectThatIAmWillingToAccept * (2 ** (pubkeyretrynumber))):
shared.networkDefaultPayloadLengthExtraBytes += 14000 #increase POW for each object dropped
resendPubkey(pubkeyretrynumber,toripe) resendPubkey(pubkeyretrynumber,toripe)
else: # status == msgsent else: # status == msgsent
if (int(time.time()) - lastactiontime) > (shared.maximumAgeOfAnObjectThatIAmWillingToAccept * (2 ** (msgretrynumber))): if (int(time.time()) - lastactiontime) > (shared.maximumAgeOfAnObjectThatIAmWillingToAccept * (2 ** (msgretrynumber))):
shared.networkDefaultPayloadLengthExtraBytes += 14000 #increase POW for each object dropped
resendMsg(msgretrynumber,ackdata) resendMsg(msgretrynumber,ackdata)
# Let's also clear and reload shared.inventorySets to keep it from # Let's also clear and reload shared.inventorySets to keep it from