Moved dbTimestamps and newPeers to KV for more decoupling

This commit is contained in:
Kevin 2020-07-26 15:49:34 -05:00
parent e00d41f8a9
commit 97a5f50271
7 changed files with 23 additions and 16 deletions

View file

@ -66,6 +66,8 @@ class OnionrCommunicatorDaemon:
self.kv.put('onlinePeers', [])
self.kv.put('currentDownloading', [])
self.kv.put('announceCache', {})
self.kv.put('newPeers', [])
self.kv.put('dbTimestamps', {})
if config.get('general.offline_mode', False):
self.isOnline = False
@ -91,8 +93,7 @@ class OnionrCommunicatorDaemon:
self.connectTimes = {}
# list of peer's profiles (onionrpeers.PeerProfile instances)
self.peerProfiles = []
# Peers merged to us. Don't add to db until we know they're reachable
self.newPeers = []
self.announceProgress = {}
self.generating_blocks = []
@ -103,10 +104,6 @@ class OnionrCommunicatorDaemon:
# timestamp when the last online node was seen
self.lastNodeSeen = None
# Dict of time stamps for peer's block list lookup times,
# to avoid downloading full lists all the time
self.dbTimestamps = {}
# Loads in and starts the enabled plugins
plugins.reload()

View file

@ -30,7 +30,7 @@ def remove_online_peer(comm_inst, peer):
except KeyError:
pass
try:
del comm_inst.dbTimestamps[peer]
del kv.get('dbTimestamps')[peer]
except KeyError:
pass
try: