work on peer cleanup

This commit is contained in:
Kevin Froman 2018-08-02 02:28:26 -05:00
parent d22701199c
commit 8bb5014d41
No known key found for this signature in database
GPG key ID: 0D414D0FE405B63B
3 changed files with 14 additions and 5 deletions

View file

@ -199,7 +199,8 @@ class Core:
DBHash text,
powValue text,
failure int,
lastConnect int
lastConnect int,
lastConnectAttempt int
);
''')
conn.commit()
@ -573,7 +574,7 @@ class Core:
c = conn.cursor()
command = (data, address)
# TODO: validate key on whitelist
if key not in ('address', 'type', 'knownPeer', 'speed', 'success', 'DBHash', 'failure', 'lastConnect'):
if key not in ('address', 'type', 'knownPeer', 'speed', 'success', 'DBHash', 'failure', 'lastConnect', 'lastConnectAttempt'):
raise Exception("Got invalid database key when setting address info")
else:
c.execute('UPDATE adders SET ' + key + ' = ? WHERE address=?', command)