Bitmessage/PyBitmessage — pull request #722 by p2pmessage (2014-09-24 22:29:53+00:00)
Title: The idea behind this fix is to prioritize the outgoing object inventory by proof of work strength and calculate at least as much proof of work on the messages we originate so they never have much less than average priority. To achieve this goal the following changes were made: -arithmetic.py- Defines isqrt function to calculate integer square roots of large integers. -shared.py- Defines averageNonceTrialsPerByteActual, countNonceTrialsPerByteActual, and the addInventory function (to calculate these values and add objects to inventory). Code updated to call addInventory when adding objects to inventory. -helper_startup.py- Adds 'averagenoncetrialsperbyteactual' and 'countnoncetrialsperbyteactual' to newly generated keys.dat files. -class_sqlThread.py- Reads 'averagenoncetrialsperbyteactual' and 'countnoncetrialsperbyteactual' from keys.dat (or adds them if they don't exist) and resets 'countnoncetrialsperbyteactual' to its square root (with arithmetic.isqrt) when vacuuming messages.dat. -class_singleCleaner.py

Warning: "Max acceptable difficulty" settings are not implemented as method for limiting the POW specified by the new parameter. We will not be implementing it, but will instead focus on porting the spam fix to the upcoming V3 protocol.