pybitmessage.randomtrackingdict module

Track randomize ordered dict

class RandomTrackingDict[source]

Bases: object

Dict with randomised order and tracking.

Keeps a track of how many items have been requested from the dict, and timeouts. Resets after all objects have been retrieved and timed out. The main purpose of this isn’t as much putting related code together as performance optimisation and anonymisation of downloading of objects from other peers. If done using a standard dict or array, it takes too much CPU (and looks convoluted). Randomisation helps with anonymity.

maxPending = 10
pendingTimeout = 60

Sets maximum number of objects that can be retrieved from the class simultaneously as long as there is no timeout


Sets how long to wait for a timeout if max pending is reached (or all objects have been retrieved)


Update timestamp for tracking of received objects


Retrieve count random keys from the dict that haven’t already been retrieved